Skip to main content
Tab

ASPxGridViewContextMenuSettings.Enabled Property

Gets or sets whether the context menu is enabled.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

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 Web Forms Controls ASPxGridView
GridViewProperties
ASP.NET MVC Extensions GridViewSettings
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 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.

ASPxGridView_ContextMenuExample

<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");
}
See Also