Torna al Thread
Private Sub HandleUpdate(ByVal row As GridViewRow, ByVal rowIndex As Integer, ByVal causesValidation As Boolean)
If ((Not causesValidation OrElse (Me.Page Is Nothing)) OrElse Me.Page.IsValid) Then
Dim data As DataSourceView = Nothing
Dim isBoundUsingDataSourceID As Boolean = MyBase.IsBoundUsingDataSourceID
If isBoundUsingDataSourceID Then
data = Me.GetData
If (data Is Nothing) Then
Throw New HttpException(SR.GetString("GridView_DataSourceReturnedNullView", New Object() { Me.ID }))
End If
End If
Dim e As New GridViewUpdateEventArgs(rowIndex)
If isBoundUsingDataSourceID Then
Dim entry As DictionaryEntry
For Each entry In Me.BoundFieldValues
e.OldValues.Add(entry.Key, entry.Value)
Next
If (Me.DataKeys.Count > rowIndex) Then
Dim entry2 As DictionaryEntry
For Each entry2 In Me.DataKeys.Item(rowIndex).Values
e.Keys.Add(entry2.Key, entry2.Value)
Next
End If
If ((row Is Nothing) AndAlso (Me.Rows.Count > rowIndex)) Then
row = Me.Rows.Item(rowIndex)
End If
If (Not row Is Nothing) Then
Me.ExtractRowValues(e.NewValues, row, False, True)
End If
End If
Me.OnRowUpdating(e)
If (Not e.Cancel AndAlso isBoundUsingDataSourceID) Then
Me._updateKeys = e.Keys
Me._updateOldValues = e.OldValues
Me._updateNewValues = e.NewValues
data.Update(e.Keys, e.NewValues, e.OldValues, New DataSourceViewOperationCallback(AddressOf Me.HandleUpdateCallback))
End If
End If
End Sub