ASPxPivotGrid.PopupMenuCreated Event

Enables you to create custom menu items.

Namespace: DevExpress.Web.ASPxPivotGrid

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


public event PivotPopupMenuCreatedEventHandler PopupMenuCreated
Public Event PopupMenuCreated As PivotPopupMenuCreatedEventHandler

Event Data

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

Property Description
Menu Gets the context menu.
MenuType Gets the context menu's type.


Handle the PopupMenuCreated event to create custom menu items. The context menu can be obtained via the PivotPopupMenuCreatedEventArgs.Menu property. Its type is returned by the PivotPopupMenuCreatedEventArgs.MenuType property.

To add a new menu item, use the MenuItemCollection.Add method. To hide default menu items, handle the ASPxPivotGrid.AddPopupMenuItem event.

To define an action for a custom menu item(s), handle the ASPxClientPivotGrid.PopupMenuItemClick event.



The complete sample project How to Add a Custom Item to the ASPxPivotGrid Popup Menu is available in the DevExpress Examples repository.

This example demonstrates how to add a custom menu item ("Hide this value") to the field value popup menu and get information on a clicked field.

In this example, the following API is used:

using DevExpress.Web.ASPxPivotGrid;
using System;
using System.Data;

namespace ASPxPivotGrid_AddCustomPopupMenuItem
    public partial class Default : System.Web.UI.Page

        protected void Page_Load(object sender, EventArgs e)
            DataSet ds = new DataSet();
            ASPxPivotGrid1.DataSource = ds.Tables[0];
        protected void ASPxPivotGrid1_PopupMenuCreated(object sender, PivotPopupMenuCreatedEventArgs e)
            if (e.MenuType == PivotGridPopupMenuType.FieldValueMenu)
                e.Menu.Items.Add("Hide this value", "hideValue");

        protected void ASPxPivotGrid1_CustomCallback(object sender, PivotGridCustomCallbackEventArgs e)
            ASPxPivotGrid pivot = (ASPxPivotGrid)sender;
            pivot.JSProperties["cpAlertMessage"] = null;
            string[] parameters = e.Parameters.Split(new char[] { '|' });
            if (parameters.Length == 5 && parameters[0] == "MenuItemClick")
                if (parameters[1] == "hideValue")
                    bool isColumn = parameters[4] == "ColumnArea";
                    PivotFieldValueEventArgs fieldValueInfo = pivot.GetFieldValueInfo(isColumn, Convert.ToInt32(parameters[3]));
                    if (isColumn)
                        pivot.JSProperties["cpAlertMessage"] = string.Format("Cannot hide the {0} column", fieldValueInfo.Value);
                        if (fieldValueInfo.Field != null)
See Also