Disable / Remove Context menu Items on right click

13 posts, 0 answers
  1. Chinna
    Chinna avatar
    24 posts
    Member since:
    Mar 2008

    Posted 21 Apr 2008 Link to this post

    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.      
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 21 Apr 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chinna
    Chinna avatar
    24 posts
    Member since:
    Mar 2008

    Posted 21 Apr 2008 Link to this post

    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  
  5. Chinna
    Chinna avatar
    24 posts
    Member since:
    Mar 2008

    Posted 21 Apr 2008 Link to this post

    hi,
            Can i disable/remove the items on node databound

    Thanks,

    Vinod
  6. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 23 Apr 2008 Link to this post

    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
  7. Chinna
    Chinna avatar
    24 posts
    Member since:
    Mar 2008

    Posted 23 Apr 2008 Link to this post

    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.
  8. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 23 Apr 2008 Link to this post

    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
  9. Dave
    Dave avatar
    17 posts
    Member since:
    Jul 2005

    Posted 25 Aug 2012 Link to this post

    Links are no longer valid - please fix these or remove the post as it causes a waste of time.
  10. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Aug 2012 Link to this post

    Hi Dave,

    Please take a look into the following documentation.
    RadMenuItem object

    Regards,
    Shinu.
  11. srihari
    srihari avatar
    8 posts
    Member since:
    Jul 2015

    Posted 14 Sep 2015 in reply to Veselin Vasilev Link to this post

    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

  12. Dimitar
    Admin
    Dimitar avatar
    281 posts

    Posted 17 Sep 2015 Link to this post

    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
  13. srihari
    srihari avatar
    8 posts
    Member since:
    Jul 2015

    Posted 21 Sep 2015 in reply to Dimitar Link to this post

    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>

  14. Dimitar
    Admin
    Dimitar avatar
    281 posts

    Posted 24 Sep 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017