GridViewSettings.SettingsCommandButton Property
In This Article
Provides access to the settings of the GridView’s command buttons.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
NuGet Package: DevExpress.Web.Mvc5
#Declaration
public ASPxGridViewCommandButtonSettings SettingsCommandButton { get; }
#Property Value
Type | Description |
---|---|
ASPx |
A ASPx |
#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.
See Also