Skip to main content

BootstrapGridView.EditFormLayoutCreated Event

Enables you to perform custom actions in response to the layout creation.

Namespace: DevExpress.Web.Bootstrap

Assembly: DevExpress.Web.Bootstrap.v24.2.dll

NuGet Package: DevExpress.Web.Bootstrap

#Declaration

public event EventHandler<BootstrapGridViewEditFormLayoutEventArgs> EditFormLayoutCreated

#Event Data

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

Property Description
EditFormLayout Gets the form layout.
RowKeyValue Gets the row’s key value. Inherited from ASPxGridViewEditFormLayoutEventArgs.
RowVisibleIndex Gets the row’s visible index. Inherited from ASPxGridViewEditFormLayoutEventArgs.

The event data class exposes the following methods:

Method Description
FindLayoutItemByColumn(String) Returns a layout item that belongs to the specified column. Inherited from ASPxGridViewEditFormLayoutEventArgs.
FindLayoutItemOrGroup(String) Returns a layout item or group object with the specified name. Inherited from ASPxGridViewEditFormLayoutEventArgs.

#Remarks

The component raises the EditFormLayoutCreated event for each data row when the form layout is created. You can handle this event to change layout items’ styles or settings based on cell values.

In addition to the event argument properties, you can use the FindLayoutItemByColumn(String) and FindLayoutItemOrGroup(String) methods to access and modify layout items or groups.

The following example illustrates how to use the FindLayoutItemOrGroup(String) method to find the “DismissalInformation” layout group and make this group visible on the client if a user enters a value in the “Dismissal Date” field.

protected void grid_EditFormLayoutCreated(object sender, BootstrapGridViewEditFormLayoutEventArgs e) {
    var layoutGroupDismissal = (BootstrapGridViewLayoutGroup)e.FindLayoutItemOrGroup("DismissalInformation");
    if(layoutGroupDismissal == null) return;
    if(GridViewEditFormLayout.IsNewRowEditing) {
        layoutGroupDismissal.Visible = false;
        return;
    }
    var fireDate = GridViewEditFormLayout.GetRowValues(e.RowVisibleIndex, "FireDate");
    layoutGroupDismissal.ClientVisible = fireDate != null && (DateTime)fireDate != DateTime.MinValue;
}
See Also