Skip to main content
A newer version of this page is available. .
Tab

ASPxGridViewContextMenuSettings.Enabled Property

Gets or sets whether the context menu is enabled.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(false)]
public bool Enabled { get; set; }

Property Value

Type Default Description
Boolean **false**

true, to enable the grid context menu; otherwise, false.

Property Paths

You can access this nested property as listed below:

Library Object Type Path to Enabled
ASP.NET Bootstrap Controls BootstrapGridView
ASP.NET Web Forms Controls ASPxGridView
GridViewProperties
GridViewSettings
GridViewSettings<RowType>
MVCxGridView
MVCxGridViewProperties

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.

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 ASPxGridView.FillContextMenuItems 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.

ASPxGridView_ContextMenuExample

<dx:ASPxGridView ID="MyGridView" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource" ClientInstanceName="myGrid" KeyFieldName="ProductID" OnFillContextMenuItems="MyGridView_FillContextMenuItems">
     <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_FillContextMenuItems(object sender, ASPxGridViewContextMenuEventArgs e) {
     e.Items.Add("Select All", "SelectAll");
     e.Items.Add("Deselect All", "DeselectAll");
}
See Also