Skip to main content
All docs
V25.1
  • Tab

    ASPxCardViewCardLayoutCreatedEventArgs.FindLayoutItemOrGroup(String) Method

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

    Namespace: DevExpress.Web

    Assembly: DevExpress.Web.v25.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

    Pass the name of a layout item or group to the FindLayoutItemOrGroup(String) method to get and access this layout item.

    In the following example, the FindLayoutItemOrGroup method gets a layout group whose name is “DismissalInformation” and makes it visible on the client if a user types a value in the “Dismissal Date” field.

    <dx:ASPxCardView ID="cardView" runat="server" OnCardLayoutCreated="cardView_CardLayoutCreated" >
        // ...
        <EditFormLayoutProperties >
            <Items>
                <dx:CardViewTabbedLayoutGroup>
                    <Items>
                        <dx:CardViewLayoutGroup ColumnCount="2" Caption="Employee Information">
                            // ...
                        </dx:CardViewLayoutGroup>
                        <dx:CardViewLayoutGroup Caption="Dismissal Information" Name="DismissalInformation">
                            <Items>
                                // ...
                            </Items>
                        </dx:CardViewLayoutGroup>
                    </Items>
                </dx:CardViewTabbedLayoutGroup>
            </Items>
        </EditFormLayoutProperties>
    </dx:ASPxCardView>
    
    protected void cardView_CardLayoutCreated(object sender, DevExpress.Web.ASPxCardViewCardLayoutCreatedEventArgs e) {
        ASPxCardView cardView = sender as ASPxCardView;
        LayoutGroup layoutGroupDismissal = (LayoutGroup)e.FindLayoutItemOrGroup("DismissalInformation");
    
        if(layoutGroupDismissal == null) return;
        if(cardView.IsNewCardEditing) {
            layoutGroupDismissal.Visible = false;
            return;
        }
        var fireDate = cardView.GetCardValues(e.CardVisibleIndex, "FireDate");
        layoutGroupDismissal.ClientVisible = fireDate != null && (DateTime)fireDate != DateTime.MinValue;
    }
    
    See Also