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

Disable Menu and Submenu Options

4 Answers 249 Views
Menu
This is a migrated thread and some comments may be shown as answers.
José Miguel
Top achievements
Rank 1
José Miguel asked on 26 Jun 2009, 06:27 PM
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

4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 01 Jul 2009, 05:27 PM
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.
0
José Miguel
Top achievements
Rank 1
answered on 02 Jul 2009, 04:48 AM
Finally it worked, thank you so much.

José Gutiérrez.
0
Manesh
Top achievements
Rank 2
answered on 07 Jul 2012, 09:51 AM
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
0
Stefan
Telerik team
answered on 11 Jul 2012, 09:40 AM
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 >>
Tags
Menu
Asked by
José Miguel
Top achievements
Rank 1
Answers by
Victor
Telerik team
José Miguel
Top achievements
Rank 1
Manesh
Top achievements
Rank 2
Stefan
Telerik team
Share this question
or