Quantcast
Viewing all articles
Browse latest Browse all 5

Re: Remove Navigation Menu Items using Asp .net C#



Your code appears to me, that it could work. However, if you are getting an Index Out of Range error (probably for a "General Employee"), the order that you remove items is important.

If you try this, and you only have 3 or 4 menu items, it will hit the error
mainMenu.Items.Remove(mainMenu.Items[0]);
mainMenu.Items.Remove(mainMenu.Items[1]);
mainMenu.Items.Remove(mainMenu.Items[2]);

However, this would work:
mainMenu.Items.Remove(mainMenu.Items[2]);
mainMenu.Items.Remove(mainMenu.Items[1]);
mainMenu.Items.Remove(mainMenu.Items[0]);


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>