Skip to main content
All docs
V23.2

BootstrapGridViewContextMenuInitializeEventArgs.CreateItem(GridViewContextMenuCommand) Method

Creates a new context menu item.

Namespace: DevExpress.Web.Bootstrap

Assembly: DevExpress.Web.Bootstrap.v23.2.dll

NuGet Package: DevExpress.Web.Bootstrap

Declaration

public BootstrapGridViewContextMenuItem CreateItem(
    GridViewContextMenuCommand command
)

Parameters

Name Type Description
command GridViewContextMenuCommand

The command.

Returns

Type Description
DevExpress.Web.Bootstrap.BootstrapGridViewContextMenuItem

The 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