This example demonstrates how to set a grid cell editor's ReadOnly
property based on the grid's state. The example application allows you to edit a field value in a new row, but the editor becomes read-only when you try to edit an existing row.
The ReadOnly property is set in the ASPxGridView.CellEditorInitialize event handler based on the value of the IsNewRowEditing property.
protected void gridView_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) {
ASPxGridView grid = sender as ASPxGridView;
if (e.Column.FieldName == "CategoryID")
e.Editor.ReadOnly = !grid.IsNewRowEditing;
}
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)