Skip to main content

CardViewSettings.CardLayoutCreated Property

Enables you to change card layout properties.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxCardViewCardLayoutCreatedEventHandler CardLayoutCreated { get; set; }

Property Value

Type Description
ASPxCardViewCardLayoutCreatedEventHandler

An ASPxCardViewCardLayoutCreatedEventHandler delegate method allowing you to implement custom processing.

Remarks

var cardView = Html.DevExpress().CardView(settings =>
{
    settings.Name = "CardView";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "CardViewPartial" };
    settings.KeyFieldName = "ID";
    ...
    settings.CardLayoutCreated = (s, e) =>
    {
        var cv = (MVCxCardView)s;
        if (Convert.ToInt32(cv.GetCardValues(e.VisibleIndex, "ID")) == 2)
        {
            e.Properties.ForEach((item) =>
            {
                var cardLayoutItem = item as MVCxCardViewColumnLayoutItem;
                if (cardLayoutItem != null)
                    if (cardLayoutItem.ColumnName == "Test")
                        cardLayoutItem.Visible = false;
            });
        }
    };
});
See Also