What is the proper way to remove a row and set the previous row as active(if # of rows > 0) on a sorted and/or filtered and/or grouped radGridView?
I populate my radGridView manually with a stored procedure.
The first column in the rGV is a button column when the user presses the button the row should be removed and the previous row set as active/current.
I had this working perfectly when using the DataGridView included with VS2012 but now I'm getting an IndexOutOfRangeException thrown.
I populate my radGridView manually with a stored procedure.
The first column in the rGV is a button column when the user presses the button the row should be removed and the previous row set as active/current.
I had this working perfectly when using the DataGridView included with VS2012 but now I'm getting an IndexOutOfRangeException thrown.
Private Sub DataGridView4_CellContentClick(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles DataGridView4.CellClick
If e.ColumnIndex = 0 Then
intDataGridSelectedIndexRenewalC = DataGridView4.CurrentRow.Index
If sps_EIPHasBeenBilled(DataGridView4.CurrentRow.Cells("Policy_no").Value.ToString) Then
RenewalsCommercialMarkComplete()
Else
MsgBox("Unable to Mark This Policy as Complete! " & DataGridView4.CurrentRow.Cells("Policy_no").Value.ToString & " Has Not been Billed Yet.", vbOKOnly)
End If
End If
End Sub
Private Sub RenewalsCommercialMarkComplete()
Dim UpdateStatus As Boolean
Dim SQLQuery As String = "exec " & strDefaultDatabase & ".dbo.spu_EIPRenewalMarkCompleteByRenewalID '" & DataGridView4.CurrentRow.Cells("RenewalsID").Value & "', '" & strLoggedInUserFullName & "'"
If MsgBox("Do you wish to mark this record: " & DataGridView4.CurrentRow.Cells("Customer").Value.ToString & ": " & DataGridView4.CurrentRow.Cells("Policy_no").Value.ToString & " as complete?", vbYesNo + vbQuestion, "Renewal Mark Complete") = vbYes Then
UpdateStatus = WriteSQL_Data(SQLQuery)
If UpdateStatus Then
MsgBox("Record: " & DataGridView4.CurrentRow.Cells("Policy_no").Value.ToString & " Marked As Complete!", MsgBoxStyle.OkOnly)
DataGridView4.ChildRows(intDataGridSelectedIndexRenewalC).Delete()
If (intDataGridSelectedIndexRenewalC - 1) > 0 Then
DataGridView4.ChildRows(intDataGridSelectedIndexRenewalC - 1).IsSelected = True
DataGridView4.ChildRows(intDataGridSelectedIndexRenewalC - 1).IsCurrent = True
End If
Else
MsgBox("Unable to Connect to Database Please see your System Administrator with Error: Summary - ButtonOk_Click: ", vbOK)
End If
Else
MsgBox("The Operation was Cancelled", vbOKOnly)
End If
End Sub