GridViewSettings.EditFormLayoutCreated Property
Enables you to perform custom actions in response to the layout creation.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
public EventHandler<ASPxGridViewEditFormLayoutEventArgs> EditFormLayoutCreated { get; set; }
Property Value
Type | Description |
---|---|
EventHandler<ASPxGridViewEditFormLayoutEventArgs> | A delegate method that allows you to implement custom processing. |
Remarks
In the following example, the FindLayoutItemOrGroup(String) method gets a layout group whose name is “DismissalInformation” and makes it visible on the client if a user enters a value in the “Dismissal Date” field.
var grid = Html.DevExpress().GridView(settings => {
settings.Name = "gvEditing";
// ...
settings.EditFormLayoutProperties.Items.AddTabbedGroupItem(tabbedGroupSettings => {
tabbedGroupSettings.ColumnSpan = 2;
tabbedGroupSettings.Items.AddGroupItem(groupEmployeeInformation => {
groupEmployeeInformation.ColumnCount = 2;
groupEmployeeInformation.Caption = "Employee Information";
// ...
groupEmployeeInformation.Items.AddGroupItem(groupSettings => {
groupSettings.GroupBoxDecoration = GroupBoxDecoration.None;
groupSettings.Paddings.PaddingBottom = Unit.Pixel(0);
groupSettings.Items.Add("HireDate");
groupSettings.Items.Add("Title");
groupSettings.Items.Add("FireDate").Caption = "Dismissal Date";
});
// ...
});
tabbedGroupSettings.Items.AddGroupItem(groupDismissalInformation => {
groupDismissalInformation.Caption = "Dismissal Information";
groupDismissalInformation.Name = "DismissalInformation";
groupDismissalInformation.Items.AddGroupItem(groupSettings => {
groupSettings.GroupBoxDecoration = GroupBoxDecoration.None;
groupSettings.Items.Add("FireReason").Caption = "Reason for Dismissal";
groupSettings.Items.Add("NewCompany").Caption="New Employer";
groupSettings.Items.Add("References");
});
});
});
settings.EditFormLayoutCreated = (sender, evargs) => {
MVCxGridView gridView = sender as MVCxGridView;
LayoutGroup layoutGroupDismissal = (LayoutGroup)evargs.FindLayoutItemOrGroup("DismissalInformation");
if(layoutGroupDismissal == null) return;
if(gridView.IsNewRowEditing) {
layoutGroupDismissal.Visible = false;
return;
}
var fireDate = gridView.GetRowValues(evargs.RowVisibleIndex, "FireDate");
layoutGroupDismissal.ClientVisible = fireDate != null && (DateTime)fireDate != DateTime.MinValue;
};
})
Online Demo
See Also