Hello,
I'm using CellBeginEdit event on RadGridView to optionally cancel the edit depending on the contents on the cell. Some example code is below.
But what if the cell is edited is not in the top level hierarchy? I'm using a hierarchy gridview with relations. RowIndex cannot tell me this. How can I know this? I just want to access the DataBoundItem on the current editing cells row.
public static void CellBeginEdit_ReadonlyRows(object sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e) |
{ |
if (e.RowIndex == -1) |
return; |
RadGridView gridView = sender as RadGridView; |
if (gridView == null) |
return; |
MyEditableEntry groupItem = gridView.Rows[e.RowIndex].DataBoundItem as MyEditableEntry; |
if (groupItem == null || !groupItem.IsEditable) |
e.Cancel = true; |
else |
e.Cancel = false; |
} |