Skip to main content
All docs
V23.2
Tab

ASPxGridViewContextMenuInitializeEventArgs.CreateItem(String, String) Method

Creates a new context menu item.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.2.dll

NuGet Package: DevExpress.Web

Declaration

public GridViewContextMenuItem 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
GridViewContextMenuItem

The context menu item.

Remarks

<dx:ASPxGridView ID="Grid" OnContextMenuInitialize="Grid_ContextMenuInitialize" >
    ...
</dx:ASPxGridView>
protected void Grid_ContextMenuInitialize(object sender, ASPxGridViewContextMenuInitializeEventArgs 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