المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : i want code to remove submenu



C# Programming
04-15-2013, 12:00 AM
i am working in designing website using C# in visual studio 2010... all my pages comes under one page which is a master page .The master page contain menu which will appear in all other pages.... my request is :

1- when the user of the system will login for example as admin then all menu will appear for him while the the rest users will be able to see all the menu with all submenu except the menu that list admin rule activity which will be appear if they login only as admin....

i try to use the following code but it show error on( NavigationMenu) please provide me with the write code if possible void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { // Retrieve the root menu item from the Items // collection of the Menu control. MenuItem homeMenuItem = NavigationMenu.Items[0]; // Retrieve the Movie submenu item from the ChildItems // collection of the root menu item. MenuItem movieSubMenuItem = NavigationMenu.FindItem(@"Home\Movies"); // Remove the Movie submenu item. if (movieSubMenuItem != null) { homeMenuItem.ChildItems.Remove(movieSubMenuItem); } } }