aspnetmvc-devexpress-dot-web-dot-mvc-dot-gridviewsettings-dabc93de.md
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
public ASPxGridViewCommandButtonSettings SettingsCommandButton { get; }
Public ReadOnly Property SettingsCommandButton As ASPxGridViewCommandButtonSettings
| Type | Description |
|---|---|
| ASPxGridViewCommandButtonSettings |
A ASPxGridViewCommandButtonSettings object containing the settings of the GridView’s command buttons.
|
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.
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.
See Also