Skip to main content
All docs
V24.1

BootstrapGridView.ContextMenuInitialize Event

Occurs when the context menu is initialized.

Namespace: DevExpress.Web.Bootstrap

Assembly: DevExpress.Web.Bootstrap.v24.1.dll

NuGet Package: DevExpress.Web.Bootstrap

Declaration

public event BootstrapGridViewContextMenuInitializeEventHandler ContextMenuInitialize

Event Data

The ContextMenuInitialize event's data class is BootstrapGridViewContextMenuInitializeEventArgs. The following properties provide information specific to this event:

Property Description
ContextMenu Gets the context menu.
MenuType Gets the context menu type. Inherited from ASPxGridViewContextMenuInitializeEventArgs.

The event data class exposes the following methods:

Method Description
CreateItem(GridViewContextMenuCommand) Creates a new context menu item.
CreateItem(String, String) Creates a new context menu item.

Remarks

<dx:BootstrapGridView runat="server" 
    OnContextMenuInitialize="GridViewContextMenu_ContextMenuInitialize">
    <SettingsContextMenu Enabled="true" />
    //...
</dx:BootstrapGridView>
protected void GridViewContextMenu_ContextMenuInitialize(object sender, BootstrapGridViewContextMenuInitializeEventArgs e) {
    if(e.MenuType == GridViewContextMenuType.Rows) {
        var item = e.CreateItem("Export", "Export");
        item.BeginGroup = true;

        e.ContextMenu.Items.Insert(e.ContextMenu.Items.IndexOfCommand(GridViewContextMenuCommand.Refresh), item);
        item.Items.Add(e.CreateItem(GridViewContextMenuCommand.ExportToPdf));
        //...
    }
}

Online Demo

See Also