New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnClientContextMenuItemClicked
The OnClientContextMenuItemClicked client-side event occurs when the user clicks the context menu item for a node.
The event handler receives parameters:
-
The TreeView instance that fired the event.
-
Event arguments with functions:
-
get_menuItem() retrieves a reference to the selected context menu item. You can also call get_menu() from the menu item reference and use the menu to retrieve the other items on the menu.
-
get_node() retrieves a reference to the clicked on node.
-
get_domEvent() retrieves the DOM event object of the item click.
The example below displays the text for the selected context menu item, the text for the node and the ID for the menu.
ASPNET
<telerik:RadTreeView RenderMode="Lightweight" ID="RadTreeView1" runat="server" MultipleSelect="True" CheckBoxes="True"
EnableDragAndDrop="True" AllowNodeEditing="True" OnClientContextMenuItemClicked="ClientContextMenuItemClicked">
<Nodes>
<telerik:RadTreeNode runat="server" ExpandMode="ClientSide" Text="Search" ImageUrl="~/images/search.ico"
Expanded="True" Value="1">
</telerik:RadTreeNode>
</Nodes>
<ContextMenus>
<telerik:RadTreeViewContextMenu ID="SearchMenu" runat="server" Flow="Horizontal">
<DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" />
<Items>
<telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Local Search">
<GroupSettings ExpandDirection="Auto" Flow="Vertical" />
</telerik:RadMenuItem>
<telerik:RadMenuItem runat="server" ExpandMode="ClientSide" Text="Search Network">
<GroupSettings ExpandDirection="Auto" Flow="Vertical" />
</telerik:RadMenuItem>
</Items>
</telerik:RadTreeViewContextMenu>
</ContextMenus>
</telerik:RadTreeView>