All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ASPxClientGantt.ContextMenu Event

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

Declaration

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.

Remarks

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.

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

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

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

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

Online Demo

See Also