Skip to main content
Tab

ASPxGridViewEditFormLayoutEventArgs.FindLayoutItemOrGroup(String) Method

Returns a layout item or group object with the specified name.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public LayoutItemBase FindLayoutItemOrGroup(
    string name
)

Parameters

Name Type Description
name String

The layout item or group name.

Returns

Type Description
LayoutItemBase

The layout item or group.

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 fills the “Dismissal Date” field.

GridView - FindLayoutItemOrGroup Method

<dx:ASPxGridView ID="grid" runat="server" OnEditFormLayoutCreated="grid_EditFormLayoutCreated" >
    // ...
    <EditFormLayoutProperties >
        <Items>
            <dx:GridViewTabbedLayoutGroup>
                <Items>
                    <dx:GridViewLayoutGroup ColumnCount="2" Caption="Employee Information">
                        // ...
                    </dx:GridViewLayoutGroup>
                    <dx:GridViewLayoutGroup Caption="Dismissal Information" Name="DismissalInformation">
                        <Items>
                            // ...
                        </Items>
                    </dx:GridViewLayoutGroup>
                </Items>
            </dx:GridViewTabbedLayoutGroup>
        </Items>
    </EditFormLayoutProperties>
</dx:ASPxGridView>
protected void grid_EditFormLayoutCreated(object sender, DevExpress.Web.ASPxGridViewEditFormLayoutEventArgs e) {
    ASPxGridView gridView = sender as ASPxGridView;
    LayoutGroup layoutGroupDismissal = (LayoutGroup)e.FindLayoutItemOrGroup("DismissalInformation");

    if(layoutGroupDismissal == null) return;
    if(gridView.IsNewRowEditing) {
        layoutGroupDismissal.Visible = false;
        return;
    }
    var fireDate = gridView.GetRowValues(e.RowVisibleIndex, "FireDate");
    layoutGroupDismissal.ClientVisible = fireDate != null && (DateTime)fireDate != DateTime.MinValue;
}

Related Client-Side API:

Online Demo

See Also