Hello,
I have a grid with certain fields that are not editable depending on the value of other fields on that row. The best way I came up with to handle this was to wire up the CellBeginEdit event, and if the field is not allowed to be edited, then cancel the event.
I have a grid with certain fields that are not editable depending on the value of other fields on that row. The best way I came up with to handle this was to wire up the CellBeginEdit event, and if the field is not allowed to be edited, then cancel the event.
Private Sub rgvLines_CellBeginEdit(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellCancelEventArgs) Handles rgvLines.CellBeginEdit |
Select Case e.ColumnIndex |
Case rgvLines.Columns("MFG_ENTITY_ID").Index |
Dim lineCategoryTypeId As Integer |
Dim lineCategoryShortName As String = Nothing |
'Get the Line Category short name |
lineCategoryTypeId = CType(rgvLines.CurrentRow.Cells("LINE_CATEGORY_TYPE_ID").Value, Integer) |
lineCategoryShortName = GlobalMethods.GetTypeDefShortNameForTypeID(lineCategoryTypeId) |
If lineCategoryShortName = AppDefs.LineCategoryShortName.Group |
e.Cancel = True |
End if |
End Select |
End Sub |
This all works fine but the problem that I am having is that if the user has tabbed into this cell, then focus still stays with the cell that editing was cancelled for. The default behavior is for tabbing to skip over read-only columns. So once I cancel the CellBeginEdit event, how can I get to the next editable cell? Is it possible to simulate the tab key press programmatically?
Thanks,
Sean