Skip to main content
Tab

ASPxGridView.StartRowEditing Event

Enables you to prevent a row from being edited.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.2.dll

NuGet Package: DevExpress.Web

#Declaration

public event ASPxStartRowEditingEventHandler StartRowEditing

#Event Data

The StartRowEditing event's data class is ASPxStartRowEditingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets a value indicating whether the event should be canceled. Inherited from CancelEventArgs.
EditingKeyValue Gets the processed row’s key value.

#Remarks

The StartRowEditing event occurs when an end-user has clicked the Edit command or the ASPxGridView.StartEdit method has been called. To prevent switching the ASPxGridView to edit mode, set the event parameter’s Cancel property to true.

#Example

The code sample below demonstrates how you can prohibit a user from editing data rows containing information unrelated to the Sales department.

string UserDepartment = "Sales";
...
protected void MyGridView_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e) {
     if (MyGridView.GetRowValuesByKeyValue(e.EditingKeyValue, "Department").ToString() != UserDepartment) {
          e.Cancel = true;
     }
}
See Also