I want to disable / remove context menu items on treeview item right click
Scenario:
I have a treeview of the following structure:
Root --> Item1.1
-->Item1.2--->Item1.2.1
-->Item1.3-->Item1.3.1
My Context Menu with Items A,B,C,D,E
On Root node right click i have to get only Context menu Item A only other items have to be disbaled / removed from the context menu.
Similarly on Item 1.1 right click i have to get Item B,C in the context menu.
Quick help in this regard will be helpful.
Thanks,
Vinod.
12 Answers, 1 is accepted
One of the approaches is to define different RadContextMenus for root nodes and for child nodes.
Then depending on the item that is right clicked you will show either the first or the second menu.
I have prepared a small project for you. Please download it and give it a try.
I hope this helps.
All the best,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

I can't have two Context menus in this context, I can have only one is there any way to remove items dynamically on right click by getting the type of the node.
Thanks,
Vinod

Can i disable/remove the items on node databound
Thanks,
Vinod
On NodeDatabound event you can set the Enabled and/or Visible properties of the node to True / False.
Also you can use the client-side methods enable/disable or hide/show.
More information is available in our online help: RadMenuItem object
Best wishes,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

My query is not about disabling nodes of a tree view. I want to disable Context menu items based on the node selected.
Thanks,
Vinod.
You can use the client-side methods enable/disable or hide/show of RadMenuItem object.
More information is available here: RadMenuItem object
Kind regards,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center



Hi Veselin,
how to set enable and disable contextmenu subitems as per the node level select and change the item text in radtreeview.
please find the attached file.
pleae give the proper solution.
Regards
P. Srihari
I would suggest you to take a look at the TreeView Context Menus demo and the help articles referenced at its About this demo section. They would help you achieve the desired functionality.
Regards,
Dimitar
Telerik

i unable to disbable/enable subitems.
Please find the below code
<telerik:RadTreeView ID="rtv1" Skin="Web20" runat="server" Font-Size="Small" OnClientContextMenuShowing="onClientContextMenuShowingorg" OnClientContextMenuItemClicking="onClientContextMenuItemClickingorg"
Width="700px" CheckBoxes="true" OnNodeCheck="rtvw1_NodeCheck" OnNodeExpand="rtvw1_Expand" OnContextMenuItemClick="rtvw1_ContextMenuItemClick">
<ContextMenus>
<telerik:RadTreeViewContextMenu ID="Org1" runat="server">
<Items>
<telerik:RadMenuItem Value="Choose" Text="Choose" PostBack="false">
<Items>
<telerik:RadMenuItem Value="This item" Text="This item" Enabled="true"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="All siblings of this item" Text="All siblings of this item" Enabled="false"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="This item and all below it" Text="This item and all below it (must expand first)" Enabled="false"></telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
<telerik:RadMenuItem Value="Expand" Text="Expand" PostBack="false">
<Items>
<telerik:RadMenuItem Value="1" Text="1"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="2" Text="2"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="3" Text="3"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="4" Text="4"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="5" Text="5"></telerik:RadMenuItem>
<telerik:RadMenuItem Value="6" Text="6"></telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
<telerik:RadMenuItem Value="Locate Browser" Text="Locate Browser" Enabled="true"></telerik:RadMenuItem>
</Items>
</telerik:RadTreeViewContextMenu>
</ContextMenus>
</telerik:RadTreeView>
I am afraid that I cannot reproduce such an issue on my side with our latest version Q2 2015 SP1. Here is a screenshot of the RadTreeView and ContextMenu I observe. Could you test with our latest version as it should fix the issue? I tested Firefox, Chrome, IE7+ browsers.
Regards,
Dimitar
Telerik