GridViewSettings.SettingsCommandButton Property

Provides access to the settings of the GridView's command buttons.

Namespace: DevExpress.Web.Mvc

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

Declaration

public ASPxGridViewCommandButtonSettings SettingsCommandButton { get; }
Public ReadOnly Property SettingsCommandButton As ASPxGridViewCommandButtonSettings

Property Value

Type Description
ASPxGridViewCommandButtonSettings

A ASPxGridViewCommandButtonSettings object containing the settings of the GridView's command buttons.

Remarks

Use the SettingsCommandButton property to get the access to the individual command button settings. Refer to the Command Column to learn more about configuring the command buttons.

Example

The code sample below demonstrates how to change the settings of the "New" button. In this example, the "New" button is rendered as an image with a specific icon.


@Html.DevExpress().GridView(settings => {
    settings.Name = "GridView";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartial" };
    // ...
    // Show the "New" button within the column header. 
    settings.CommandColumn.ShowNewButtonInHeader = true;
    // Change the "New" button settings. 
    settings.SettingsCommandButton.NewButton.ButtonType = GridViewCommandButtonType.Image;
    settings.SettingsCommandButton.NewButton.Image.IconID = IconID.ActionsAdditem16x16;

    settings.KeyFieldName = "ID";
    settings.Columns.Add("FirstName");
    settings.Columns.Add("LastName");
    settings.Columns.Add("Age");
}).Bind(Model).GetHtml()

The image below illustrates the result.

MVC_Grid_Columns_CommandButtonSettings

See Also