A newer version of this page is available. Switch to the current version.

ASPxClientGridView.ContextMenuItemClick Event

Fires on the client side when a context menu item has been clicked.


ContextMenuItemClick: ASPxClientEvent<ASPxClientGridViewContextMenuItemClickEventHandler<ASPxClientGridView>>

Event Data

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

Property Description
elementIndex Returns the processed element index.
handled Specifies whether default context menu item click is handled manually, so no default processing is required.
item Gets the clicked context menu item.
objectType Gets which grid element has been right clicked by the user.
processOnServer Gets or sets a value that specifies whether the event should be finally processed on the server side. Inherited from ASPxClientProcessingModeEventArgs.
usePostBack Specifies whether a postback or a callback is used to finally process the event on the server side.


Write a ContextMenuItemClick event handler to perform specific actions on the client side when a context menu item has been clicked. Note that this event fires immediately after the left mouse button is released. If the button is released when the mouse pointer is not over a thumbnail, the event doesn't fire.

On the server side, you can respond to a context menu item click using the ASPxGridView.ContextMenuItemClick event.


The code sample below demonstrates how to provide the default grid context menu with two custom items. To add the items to the item collection, the ASPxGridView.FillContextMenuItems event is used. On the client-side, the ASPxClientGridView.ContextMenuItemClick event is handled to respond to a custom item click.

The image below demonstrates a context menu with the custom items.


<dx:ASPxGridView ID="MyGridView" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource" ClientInstanceName="myGrid" KeyFieldName="ProductID" OnFillContextMenuItems="MyGridView_FillContextMenuItems">
     <ClientSideEvents ContextMenuItemClick="function(s, e) {
          switch(e.item.name) { 
               case 'SelectAll':
               case 'DeselectAll':
     }" />
     <SettingsBehavior AllowSelectByRowClick="True" />
     <SettingsContextMenu Enabled="True">
See Also