Skip to main content
A newer version of this page is available. .
Tab

ASPxCardView.CardLayoutCreated Event

The event occurs when the card layout is created.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public event ASPxCardViewCardLayoutCreatedEventHandler CardLayoutCreated

Event Data

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

Property Description
IsEditingCard Gets whether the card is in edit mode.
Properties Contains settings related to the FormLayout used in the processed card.
VisibleIndex Gets the visible index of the processed card.

The event data class exposes the following methods:

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

Remarks

The card view raises the CardLayoutCreated event for each data card when the corresponding card layout is created. You can handle this event to change card 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 FindLayoutItemByColumn(String) method to find a card’s layout items that belong to the specified columns. It also allows you to change these items’ visibility and column-span if the card is in edit mode.

protected void ASPxCardView1_CardLayoutCreated(object sender, ASPxCardViewCardLayoutCreatedEventArgs e) {
    // Applies the card layout to the Edit Form only
    if(e.IsEditingCard) {
        ASPxCardView cardView = sender as ASPxCardView;
        if(cardView.IsNewCardEditing) {
            LayoutItem itemOrderID = e.FindLayoutItemByColumn(cardView.KeyFieldName);
            itemOrderID.ClientVisible = false;
            LayoutItem itemProductName = e.FindLayoutItemByColumn("ProductName");
            itemProductName.ColumnSpan = 2;
        }
    }
}
See Also