Skip to main content

GridView.EditFormShowing Event

Occurs when an Edit Form is about to be displayed, and allows you to cancel the action.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

[DXCategory("Editor")]
public event EditFormShowingEventHandler EditFormShowing

Event Data

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

Property Description
Allow Gets or sets whether opening an Edit Form is allowed.
RowHandle Gets the row handle that identifies the grid row for which an Edit Form is opening.

Remarks

You can respond to an Edit Form opening by handling the EditFormShowing event. The EditFormShowingEventArgs class contains information about this event. You can cancel opening an Edit Form by setting the EditFormShowingEventArgs.Allow property to false. To get a handle that identifies a grid row (see Rows) for which an Edit Form is about to be displayed, use the EditFormShowingEventArgs.RowHandle property.

After the EditFormShowing event, the GridView.EditFormPrepared event fires, which allows you to customize the Edit Form.

Example

The following example shows how to prohibit an Edit Form from opening in specific rows.

In this example, the GridView.EditFormShowing event is handled and the Allow event parameter is set to false for orders shipped to France.

using DevExpress.XtraGrid.Views.Grid;

gridView1.EditFormShowing += new EditFormShowingEventHandler(OnEditFormShowing);
//...
private void OnEditFormShowing(object sender, EditFormShowingEventArgs e) {
    GridView view = sender as GridView;
    if (view == null) return;
    if (view.GetRowCellValue(e.RowHandle, "ShipCountry").ToString() == "France") e.Allow = false;
}
See Also