aspnetmvc-devexpress-dot-web-dot-mvc-dot-gridviewsettings-8728eead.md
Enables you to customize the context menu when it is initialized.
Namespace : DevExpress.Web.Mvc
Assembly : DevExpress.Web.Mvc5.v25.2.dll
NuGet Package : DevExpress.Web.Mvc5
public ASPxGridViewContextMenuInitializeEventHandler ContextMenuInitialize { get; set; }
Public Property ContextMenuInitialize As ASPxGridViewContextMenuInitializeEventHandler
| Type | Description |
|---|---|
| ASPxGridViewContextMenuInitializeEventHandler |
A delegate method.
|
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;
}
};
See Also