Skip to main content

GridViewSettings.ContextMenuInitialize Property

Enables you to customize the context menu when it is initialized.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public ASPxGridViewContextMenuInitializeEventHandler ContextMenuInitialize { get; set; }

Property Value

Type Description
ASPxGridViewContextMenuInitializeEventHandler

A delegate method.

Remarks

The following example illustrates how to add a new context menu item when a user right clicks a grid row (MenuType):

settings.ContextMenuInitialize = (s, e) => {
    if(e.MenuType == GridViewContextMenuType.Rows) {
        var exportMenuItem = e.ContextMenu.Items.FindByCommand(GridViewContextMenuCommand.ExportMenu);
        exportMenuItem.Items.Add("Custom export to XLS(WYSIWYG)", "CustomExportToXLS").Image.IconID = DevExpress.Web.ASPxThemes.IconID.ExportExporttoxls16x16;
    }
};

Online Demo

See Also