TelerikDeveloper.com

TelerikDeveloper.com

RuthO 10/4/2011 5:47:00 PM

Telerik - RadGridView UserDeletingRow

This code example shows how to code the Telerik RadGridView UserDeletingRow event, and to confirm the delete before processing.

 



 

Private Sub RadGridView1_UserDeletingRow(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewRowCancelEventArgs) Handles RadGridView1.UserDeletingRow
    Dim strItemNumber As String = ""
    Dim strCustomerNumber As String = ""
    Dim intAnswer As MsgBoxResult
    Try
        'confirm the delete
        intAnswer = MsgBox("Confirm Delete?", MsgBoxStyle.OkCancel, "Delete?")
        If intAnswer = vbOK Then
            'there might be more than one row being deleted
            For Each oRow As GridViewDataRowInfo In e.Rows
                'get data from the row
                strItemNumber = oRow.Cells.Item("itemnmbr").Value
                strCustomerNumber = oRow.Cells.Item("custnmbr").Value
                'data access code to delete the grid line
                dynData.SPs.FP_IV00101Cost_DEL(strItemNumber, strCustomerNumber, appUser.Db).execute()
            Next
        Else
            e.Cancel = True
        End If
    Catch ex As Exception
        'cancel the delete
        e.Cancel = True
        'call the global error handling routine
        GlobalErrorHandler(ex)
    End Try
End Sub