Back to Devexpress

GridViewSettings.SettingsCommandButton Property

aspnetmvc-devexpress-dot-web-dot-mvc-dot-gridviewsettings-dabc93de.md

latest2.9 KB
Original Source

GridViewSettings.SettingsCommandButton Property

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

Namespace : DevExpress.Web.Mvc

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

NuGet Package : DevExpress.Web.Mvc5

Declaration

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

Property Value

TypeDescription
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.

cshtml
@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.

See Also

Grid View

Command Item

Command Column

GridViewSettings Class

GridViewSettings Members

DevExpress.Web.Mvc Namespace