Skip to main content
A newer version of this page is available. .

ASPxPivotGrid.AddPopupMenuItem Event

Enables you to customize the context menu.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v20.2.dll

NuGet Package: DevExpress.Web

Declaration

public event PivotAddPopupMenuItemEventHandler AddPopupMenuItem

Event Data

The AddPopupMenuItem event's data class is PivotAddPopupMenuItemEventArgs. The following properties provide information specific to this event:

Property Description
Add Gets or sets whether the processed menu item should be displayed within the menu.
MenuItem Gets which menu item is currently being processed.

Remarks

The AddPopupMenuItem event enables you to hide individual menu items. For instance, you can hide the ‘Hide’ menu item to prevent a user from hiding fields.

Note

To add custom menu items, handle the ASPxPivotGrid.PopupMenuCreated event.

The item currently being processed is identified by the event parameter’s MenuItem property. It’s visibility is controlled by the Add property. Set this property to false to hide the item from the menu.

Example

This example demonstrates how to prevent end-users from hiding field headers. To do this, the ASPxPivotGrid.AddPopupMenuItem event is handled. If the processed item is the ‘Hide’ menu item, it is not added to the field header’s context menu.

protected void ASPxPivotGrid1_AddPopupMenuItem(object sender,
    DevExpress.Web.ASPxPivotGrid.PivotAddPopupMenuItemEventArgs e) {
    if (e.MenuItem == DevExpress.Web.ASPxPivotGrid.MenuItemEnum.HeaderHide)
        e.Add = false;
}
See Also