I have an ASP.NET webforms application with a Menu control. How does one hide a particular menu item via code? I've seen a few articles pointing out how to do it with ASP.Net membership/roles-based security, but this particular use case has nothing to do with that. I simply need a way to programmatically remove a menu item from code. Any help would be appreciated.
+1
A:
Doh! Ok, I figured it out. The correct syntax is (VB.Net):
mnuMyMenu.Items.Remove(mnuMyMenu.Items(1))
jwalkerjr
2009-01-10 04:54:22
You know you can accept your own answers?
Kev
2009-01-10 06:35:23
A:
also, myMenu.Items(0).ChildItems.Remove(myMenu.Items(0).ChildItems(1))
Vijay Gaur
2010-09-12 11:52:29
A:
Child Menu can't be removed, you have to set child menu text to "" and set it disable. Example : mnuShopping.Items(0).ChildItems.Item(3).Text = "" mnuShopping.Items(0).ChildItems.Item(3).Enabled = False
CNP Thailand.
2010-10-12 14:11:10