TelerikDeveloper.com

TelerikDeveloper.com

sgray128 11/5/2014 1:12:38 PM

Winforms - Gridview - CellValueChanged

CellValueChanged fires after the user LEAVES THE FIELD.

We don't used the 'sender' object, we get the values that we need through e.row and e.column

The ValueChanged event fires while the editor is still open, after every key stroke.

Normally we'd use CellValueChanged



 

 

Private Sub RadGridView1_CellValueChanged(sender As Object, e As GridViewCellEventArgs) Handles RadGridView1.CellValueChanged
     'notes:
     'CellValueChanged fires after the user leaves the fields.
     'The 'sender' will not be used, we'll get what we need through e.row and e.coumn
 
     'ValueChanged fires while the editor is still open, after every key stroke
     'normally, we'd avoid that but it's good for changes fired off by a check box header change
     Try
         If TypeOf (e.Row) Is GridViewFilteringRowInfo Then
             Exit Sub
         End If
         Dim oRow As GridViewDataRowInfo = e.Row
         Dim oCol As GridViewDataColumn = e.Column
 
 
         'If TypeOf (oRow) Is GridViewFilteringRowInfo Then
         '    Exit Sub
         'End If
 
         ''header grid
         Dim intRowID As Integer = oRow.Cells("RowID").Value
         'Dim oSOP As New SOPIntegrationWork(intRowID)
         Dim strGroup As String = oRow.Cells("groupcolumn").Value
         Dim oSOP As New SOPIntegrationWork(intRowID)
         If oSOP.CUSTNMBR Is Nothing Then
             Exit Sub
         End If
         Select Case oCol.Name.ToUpper
             Case "GROUPCOLUMN"
             Case "CUSTNMBR"
                 Dim tb As RadTextBoxEditor = CType(sender, RadTextBoxEditor)
                 oSOP.CUSTNMBR = Common.ToStr(oRow.Cells("custnmbr").Value)
             Case "JOBNUMBER"
                 oSOP.JobNumber = Common.ToStr(oRow.Cells("JOBNUMBER").Value)
             Case "INVODATE"
                 oSOP.INVODATE = Common.ToDate(oRow.Cells("INVODATE").Value)
             Case "CUSTNAME"
             Case "DOCID"
             Case "SOPTYPE"
             Case "REQUESTOR"
                 oSOP.requestor = Common.ToStr(oRow.Cells("REQUESTOR").Value)
             Case "SALESTER"
                 oSOP.SalesTer = Common.ToStr(oRow.Cells("SALESTER").Value)
             Case "CSTPONBR"
                 oSOP.CSTPONBR = Common.ToStr(oRow.Cells("CSTPONBR").Value)
             Case "DNI"
                 oSOP.DNI = Common.ToStr(oRow.Cells("DNI").Value)
 
         End Select
         oSOP.save()
     Catch ex As Exception
         ErrorHandler.globalErrorHandler(ex, True)
     End Try
 
 End Sub