ExtensionsFactory.CardView<CardType>(CardViewSettings<CardType>) Method

Creates a CardView.

Namespace: DevExpress.Web.Mvc.UI

Assembly: DevExpress.Web.Mvc5.v20.2.dll


public CardViewExtension<CardType> CardView<CardType>(
    CardViewSettings<CardType> settings
    where CardType : class
Public Function CardView(Of CardType As Class)(
    settings As CardViewSettings(Of CardType)
) As CardViewExtension(Of CardType)


Name Type Description
settings CardViewSettings<CardType>

A delegate method that accepts CardViewSettings<CardType> as a parameter.

Type Parameters



Type Description

A CardViewExtension<CardType> object implementing the CardView functionality.


To enable binding CardView columns to Model fields using lambdas, it is required to declare the CardView extension using the CardView<CardType> strongly-typed declaration method.


The partial View with the CardView extension does not need to be strongly-typed.

The code example below demonstrates how to declare the strongly-typed CardView with columns bound to data model fields via lambda expressions.

    // CardView displays instances of the Customer class.
    Html.DevExpress().CardView<Customer>(settings => {
        settings.Name = "cardView";
        settings.CallbackRouteValues = new { Controller = "Home", Action = "CardViewPartial" };

        settings.KeyFields(m => m.CustomerID);

        // The following columns are bound to Model fields via lambdas.
        settings.Columns.Add(m => m.ContactName, column => {
            column.SortIndex = 0;
            column.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
        settings.Columns.Add(m => m.CompanyName);
        settings.Columns.Add(m => m.Country);
        settings.Columns.Add(m => m.City);
        settings.Columns.Add(m => m.Region);
See Also