Skip to main content

Command Cells

The ASP.NET MVC VerticalGrid extension provides a command row that allows end-users to manipulate its data (switch the VerticalGrid to edit mode, add new records, select and deselect records, etc.). Command rows display command cells. A command cell displays command items.

VerticalGridCommandCells

The code sample below demonstrates how to enable the display of a command row with command items within its command cells.

@Html.DevExpress().VerticalGrid(settings =>
{
    settings.Name = "verticalGrid";
    // ...
    // Make the command row visible
    settings.CommandRow.Visible = true;
    // Enable the required command items displayed within the command cells
    settings.CommandRow.ShowNewButton = true;
    settings.CommandRow.ShowDeleteButton = true;
    settings.CommandRow.ShowEditButton = true;

    settings.Rows.Add("FirstName");
    settings.Rows.Add("LastName");
    // ...
}).Bind(Model).GetHtml()

The image below demonstrates the result.

MVC_VerticalGrid_CommandCells

Customizing Command Cells Using Style Settings

You can customize command cells using the common style settings for the entire command row using the VerticalGridStyles.CommandRowRecord (through VerticalGridSettings.Styles.CommandRowRecord) property, as shown in the code sample below.

@Html.DevExpress().VerticalGrid(settings =>
{
    settings.Name = "verticalGrid";
    // ...
    settings.CommandRow.Visible = true;
    // Define the background color for the entire command row
    settings.Styles.CommandRowRecord.BackColor = System.Drawing.Color.AliceBlue;
    // ...
}).Bind(Model).GetHtml()

The image below illustrates the result.

MVC_VerticalGrid_CommandCells_Styles

See Also