ASPxGridViewContextMenuSettings.Enabled Property
Gets or sets whether the context menu is enabled.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
Declaration
Property Value
Type | Default | Description |
---|---|---|
Boolean | false |
|
Property Paths
You can access this nested property as listed below:
Library | Object Type | Path to Enabled |
---|---|---|
ASP.NET MVC Extensions | GridViewSettings |
|
MVCxGridViewProperties |
|
|
ASP.NET Web Forms Controls | ASPxGridView |
|
GridViewProperties |
|
Remarks
The ASPxGridView provides different context menu types for the following elements: row, column, footer, group footer, and group panel. You can specify the visibility of all context menu types using the Enabled property. To control the menu visibility for a particular element, use the following properties.
- ASPxGridViewContextMenuSettings.EnableRowMenu – controls the visibility of a row context menu.
- ASPxGridViewContextMenuSettings.EnableColumnMenu – controls the visibility of a column header context menu.
- ASPxGridViewContextMenuSettings.EnableFooterMenu – controls the visibility of a footer context menu.
- ASPxGridViewContextMenuSettings.EnableGroupFooterMenu – controls the visibility of a group footer context menu.
- ASPxGridViewContextMenuSettings.EnableGroupPanelMenu – controls the visibility of a group panel context menu.
Example
The code sample below demonstrates how to provide the default grid context menu with two custom items. To add the items to the item collection, the ContextMenuInitialize event is used. On the client-side, the ASPxClientGridView.ContextMenuItemClick event is handled to respond to a custom item click.
The image below demonstrates a context menu with the custom items.
<dx:ASPxGridView ID="MyGridView" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource" ClientInstanceName="myGrid" KeyFieldName="ProductID" OnContextMenuInitialize="MyGridView_ContextMenuInitialize">
<ClientSideEvents ContextMenuItemClick="function(s, e) {
switch(e.item.name) {
case 'SelectAll':
myGrid.SelectRows();
break;
case 'DeselectAll':
myGrid.UnselectRows();
break;
}
}" />
<Columns>
...
</Columns>
<SettingsBehavior AllowSelectByRowClick="True" />
<SettingsContextMenu Enabled="True">
</SettingsContextMenu>
</dx:ASPxGridView>
protected void MyGridView_ContextMenuInitialize(object sender, ASPxGridViewContextMenuInitializeEventArgs e) {
e.ContextMenu.Items.Add("Select All", "SelectAll");
e.ContextMenu.Items.Add("Deselect All", "DeselectAll");
}