ASP.NET Slide Menu - Knowledge Base

« Back to Knowledge Base list

Add another control to a menu child programmatically

Q:

How can I add another control to a menu child programmatically?

A:

To add another control to a child with ID "myChild":
osm.MenuItems.GetItemById("myChild").Controls.Add(control_to_add);

You can also add a control to the last added menu item:
osm.MenuItems[osm.MenuItems.Count - 1].Controls.Add(control_to_add);