aspnet-devexpress-dot-web-dot-gridviewtoolbaritem.md
Gets or sets the name of a command executed when users click a toolbar item.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
[DefaultValue(GridViewToolbarCommand.Custom)]
public GridViewToolbarCommand Command { get; set; }
<DefaultValue(GridViewToolbarCommand.Custom)>
Public Property Command As GridViewToolbarCommand
| Type | Default | Description |
|---|---|---|
| GridViewToolbarCommand | Custom |
The toolbar item’s command name.
|
Available values:
Show 34 items
| Name | Description |
|---|---|
| Custom |
A custom user command.
| | FullExpand |
A command that expands all rows.
| | FullCollapse |
A command that collapses all rows.
| | ClearSorting |
A command that clears sorting by the current column.
| | ClearFilter |
A command that clears the filter applied to the current column.
| | ShowFilterEditor |
A command that controls the filter control visibility.
| | ShowFilterRow |
A command that controls the filter row visibility.
| | ShowFilterRowMenu |
A command that controls the filter row menu visibility.
| | ClearGrouping |
A command that clears the grouping in the grid’s group panel.
| | ShowGroupPanel |
A command that controls the group panel visibility.
| | ShowSearchPanel |
A command that controls the search panel visibility.
| | ShowCustomizationWindow |
A command that controls the Column Chooser visibility.
| | ShowFooter |
A command that controls the footer visibility.
| | ShowCustomizationDialog |
A command that controls the Customization Dialog visibility.
| | Refresh |
A command that refreshes grid data.
| | New |
A command that creates a new row.
| | Edit |
A command that allows editing the current row.
| | Delete |
A command that deletes the current row.
| | DeleteSelectedRowsOnPage |
A command that deletes the selected rows on the page.
| | Update |
A command that saves all the changes made to the current data row and switches the ASPxGridView to browse mode.
| | Cancel |
A command that discards any changes made to the current row and switches the ASPxGridView to browse mode.
| | PreviewChanges |
A command that displays the changed preview information when the control is in batch edit mode.
| | HidePreview |
A command that hides the preview when the control is in batch edit mode.
| | UpdateSummaries |
A command that recalculates total and group summaries on the client in batch edit mode.
| | ExpandRow |
A command that expands the row.
| | CollapseRow |
A command that collapses the row.
| | ExpandDetailRow |
A command that expands the detail row.
| | CollapseDetailRow |
A command that collapses the detail row.
| | ExportToPdf |
A command that exports the grid’s data to a file in PDF format.
| | ExportToDocx |
A command that exports the grid’s data to a file in DOCX format.
| | ExportToRtf |
A command that exports the grid’s data to a file in RTF format.
| | ExportToCsv |
A command that exports the grid’s data to a file in CSV format.
| | ExportToXls |
A command that exports the grid’s data to a file in XLS format.
| | ExportToXlsx |
A command that exports the grid’s data to a file in XLSX format.
|
Use the Command property to specify a command that will be executed when a toolbar item is clicked.
Note
The ASPxGridBase.KeyFieldName property should be specified when using the following grid features:
Run Demo: Grid - Customization Dialog
<dx:ASPxGridView ID="Grid" runat="server" DataSourceID="ProductsDataSource" EnableRowsCache="false" Width="100%">
<Columns>
...
</Columns>
<SettingsCustomizationDialog Enabled="true" />
<Toolbars>
<dx:GridViewToolbar Position="Top" ItemAlign="Right">
<Items>
<dx:GridViewToolbarItem Command="ShowCustomizationDialog" />
</Items>
</dx:GridViewToolbar>
</Toolbars>
</dx:ASPxGridView>
@Html.DevExpress().GridView(
settings => {
settings.Name = "grid";
settings.KeyFieldName = "PersonID";
settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewEditingPartial" };
settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Home", Action = "EditingAddNew" };
settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Home", Action = "EditingUpdate" };
settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Home", Action = "EditingDelete" };
settings.DeleteSelectedRowsRouteValues = new { Controller = "Home", Action = "EditingDeleteSelected" };
settings.SettingsBehavior.AllowFocusedRow = true;
settings.CommandColumn.Visible = true;
settings.CommandColumn.ShowNewButton = true;
settings.CommandColumn.ShowDeleteButton = true;
settings.CommandColumn.ShowEditButton = true;
settings.CommandColumn.ShowSelectCheckbox = true;
settings.Toolbars.Add(toolbar =>
{
toolbar.Enabled = true;
toolbar.Position = GridToolbarPosition.Top;
toolbar.ItemAlign = GridToolbarItemAlign.Right;
toolbar.Items.Add(GridViewToolbarCommand.New);
toolbar.Items.Add(GridViewToolbarCommand.Edit);
toolbar.Items.Add(GridViewToolbarCommand.Delete);
toolbar.Items.Add(GridViewToolbarCommand.DeleteSelectedRowsOnPage);
toolbar.Items.Add(GridViewToolbarCommand.Refresh, true);
});
settings.Columns.Add("FirstName");
settings.Columns.Add("MiddleName");
settings.Columns.Add("LastName");
}
).Bind(Model).GetHtml()
See Also