Disable Menu and Submenu Options

5 posts, 0 answers
  1. José Miguel
    José Miguel avatar
    4 posts
    Member since:
    May 2009

    Posted 26 Jun 2009 Link to this post

    I have a menu in an MDI form and I want to Disable some submenu options, How can I do that?.
    Which is the equivalent in RadControls to his line of code?:
    foreach (ToolStripMenuItem mnuitOpcion in this.menuStrip1.Items)

    Greetings,

    José Gutiérrez
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 01 Jul 2009 Link to this post

    Hi Jose Miguel,

    In case you are using RadMenu, the code looks like this:
    foreach(RadMenuItem item in this.radMenu1.Items)  
    {  
        // Do something with the items.  

    If you want to loop through all menu items in the hierarchy you can write a method similar to the one below:
    void TraverseMenuItems(RadItemCollection items)  
    {  
        foreach (RadItem item in items)  
        {  
            if (item is RadMenuItem)  
            {  
                RadMenuItem menuItem = (RadMenuItem)item;  
                // Do something with menu item  
     
                // Drill down to child items.  
                TraverseMenuItems(menuItem.Items);  
            }  
        }  

    I hope this helps. If you have additional questions, feel free to contact me.

    All the best,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. José Miguel
    José Miguel avatar
    4 posts
    Member since:
    May 2009

    Posted 01 Jul 2009 Link to this post

    Finally it worked, thank you so much.

    José Gutiérrez.
  5. Manesh
    Manesh avatar
    24 posts
    Member since:
    Feb 2012

    Posted 07 Jul 2012 Link to this post

    hey buddy, you have shown the loop and it worked well but if the menu items are more and if we made some of them visible false then then menu items were not rearranged as in the image
  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Jul 2012 Link to this post

    Your question has already been answered in the other thread you have asked it in. Please, see our answer there for more information.
    We kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    All the best,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready