Skip to main content
All docs

ASPxClientGantt.ContextMenu Event

Occurs when a user right-clicks a task or dependency to open the context menu.


ContextMenu: ASPxClientEvent<ASPxClientGanttContextMenuEventHandler<ASPxClientGantt>>

Event Data

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

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
htmlEvent Gets the DHTML event object that contains information about the processed event.
objectInfo Gets information about the right-clicked object.


The ContextMenu event enables you to create a custom context menu.

Follow the steps below to create a custom context menu:

  • Handle the ContextMenu event.

  • Set the e.cancel argument of the ContextMenuCustomization event to true to prevent the built-in context menu from showing.

To customize items of the built-in context menu, use the ContextMenuCustomization event.

Run Demo: ASPxGantt - Context Menu Run Demo: MVCxGantt - Context Menu


The example below illustrates how to show the pop-up menu when a user right-clicks the control.

Web Forms:

<dx:ASPxGantt ID="Gantt" ClientInstanceName="clientGantt" >
        ContextMenu="function(s, e) { menu.ShowAtPos(e.htmlEvent.x,e.htmlEvent.y); }" 
        ContextMenuCustomization="function(s, e) { e.cancel = true; }"

<dx:ASPxPopupMenu runat="server" ID="popup" ClientInstanceName="menu">
        <dx:MenuItem Text="Item1" />
        <dx:MenuItem Text="Item2" />


@Html.DevExpress().Gantt(settings => {
    settings.Name = "gantt";
    settings.ClientSideEvents.ContextMenuCustomization = "function (s, e) { e.cancel = true; }";
    settings.ClientSideEvents.ContextMenu = "function (s, e) { popup.ShowAtPos(e.htmlEvent.x,e.htmlEvent.y); }";
    GanttDataProvider.Tasks, GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, GanttDataProvider.ResourceAssignments

    settings.Name = "popup";
    settings.Items.Add(item => {
        item.Text = "Item 1";
        item.Name = "Item 2";
See Also