Skip to main content

Command Cells

The DevExpress ASP.NET MVC CardView extension provides command items that allow end-users to manipulate grid data (switch the card view to edit mode, update data, select and deselect cards, etc.). The card view stores its command items in command cells.

CardView-CommandItems-Visual Elements

The code sample below demonstrates how to show the “Edit” command item in a command cell.

@Html.DevExpress().CardView(settings =>
{
    settings.Name = "CardView";
    // ...
    // Enable the "Edit" command item
    settings.CardLayoutProperties.Items.AddCommandItem(i => {
        i.ShowEditButton = true;
        i.ColumnSpan = 3;
        i.HorizontalAlign = FormLayoutHorizontalAlign.Right;
    });
}).Bind(Model).GetHtml()

The image below demonstrates the result.

CardView-CommandItems

Customize Command Cells using Style Settings

The Card View allows you to customize command cells using the command column’s style settings (CardViewStyles.CommandItem).

@Html.DevExpress().CardView(settings =>
{
    settings.Name = "CardView";
    // ...
    settings.Styles.CommandItem.ForeColor = System.Drawing.Color.Red;
    // ...
}).Bind(Model).GetHtml()

The image below illustrates the result.

CardView-CustomizeCommandItem

See Also