Skip to main content
All docs
V24.1

BootstrapGridViewContextMenuInitializeEventArgs.CreateItem(String, String) Method

Creates a new context menu item.

Namespace: DevExpress.Web.Bootstrap

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

NuGet Package: DevExpress.Web.Bootstrap

Declaration

public BootstrapGridViewContextMenuItem CreateItem(
    string text,
    string name
)

Parameters

Name Type Description
text String

The text of the item.

name String

The name of the item.

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) {
        GridViewContextMenuItem item = e.CreateItem("Delete", "Delete");  
        item.Image.IconID = "menu_new_16x16";  
        e.Items.Insert(e.Items.IndexOfCommand(GridViewContextMenuCommand.DeleteRow), item);  
    }
}
See Also