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