This is a migrated thread and some comments may be shown as answers.

Disable / Remove Context menu Items on right click

12 Answers 297 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Chinna
Top achievements
Rank 1
Chinna asked on 21 Apr 2008, 03:32 PM
hi,
     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

Sort by
0
Veselin Vasilev
Telerik team
answered on 21 Apr 2008, 04:14 PM
Hi Vinod,

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
0
Chinna
Top achievements
Rank 1
answered on 21 Apr 2008, 04:55 PM
Hi Veskoni,
                    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  
0
Chinna
Top achievements
Rank 1
answered on 21 Apr 2008, 05:50 PM
hi,
        Can i disable/remove the items on node databound

Thanks,

Vinod
0
Veselin Vasilev
Telerik team
answered on 23 Apr 2008, 11:03 AM
Hello 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
0
Chinna
Top achievements
Rank 1
answered on 23 Apr 2008, 01:01 PM
Hi Veskoni,
                    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.
0
Veselin Vasilev
Telerik team
answered on 23 Apr 2008, 01:48 PM
Hello 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
0
Dave
Top achievements
Rank 1
answered on 25 Aug 2012, 10:25 PM
Links are no longer valid - please fix these or remove the post as it causes a waste of time.
0
Shinu
Top achievements
Rank 1
answered on 27 Aug 2012, 09:16 AM
Hi Dave,

Please take a look into the following documentation.
RadMenuItem object

Regards,
Shinu.
0
srihari
Top achievements
Rank 1
answered on 14 Sep 2015, 10:43 AM

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

0
Dimitar
Telerik team
answered on 17 Sep 2015, 07:28 AM
Hi 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
srihari
Top achievements
Rank 1
answered on 21 Sep 2015, 01:29 PM

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>

0
Dimitar
Telerik team
answered on 24 Sep 2015, 06:43 AM
Hi Srihari,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TreeView
Asked by
Chinna
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Chinna
Top achievements
Rank 1
Dave
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
srihari
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or