How to hide an ASP.NET menu item? - asp.net

This question was asked before but what I need is to simply hide a menu Item rather than remove it . I was surprised to see that ASp.NET MenuItem has no Visible property. is there any way really yo hide a menu Item
Thanks

you can hide the menu item using css. just use CssClass property. Using CSS and Styles with the Menu Control

I ran into the same issue and my work around was actually having two separate menus. I assigned my Admin controls that i wanted to hide in its own menu. I positioned them next to eachother as if they are one and i hide the menu when the user doesn't have access in my codebehind.

Related

Is there a way of disabling a WKInterfaceMenu?

I have a WKInterfaceMenu added to the storyboard which is working great. However, once used, I don't want the menu to appear for a second time.
Is there a way of preventing the menu from appearing?
You can definitely do this, but you need to do things a bit differently.
First off, don't set up the context menu in the storyboard. Instead, set up all the menu items programmatically. You can add and remove menu items using the addMenuItemWithImageNamed and clearAllMenuItems methods on your WKInterfaceController instance.
You want to set up all your menu items initially, then remove them in all your callback methods for each menu item. That way, they'll be there at first, and will be removed once you select one of them.

Remove some Child Items from Menu Control in ASP.NET

I know this is a very common question asked. However, I have looked all over and couldn't find a good answer that will work for my scenario.
I have a MainMenu which has SubMenus. I need to remove some items from Submenus not all.
I can easily remove items from MainMenu by using
MainMenu.Items.Remove(e.Item) in Databound event of the Menu
ForExample in following menu how can I remove sub2 from Main2 Menu.
Main1-
Main2->sub1,sub2
My Menu is bound to SiteMap.
I have tried e.Item.ChildItems.RemoveAt(0), but e.Item.ChildItems.Count for Main2 is 0.
I don't know how to solve this.
Please help.
If your menu is bound to SiteMap and you want to remove items, don't you need to make a new map and bind to that?

add hover to asp.net menu control

i have a image menu within my asp.net website. i want to include an easy solution for hoverover functionality. for example, menu item one would dispay 1.jpg on page load and hover1.jpg when a user hovers their mouse over the image. thanks for any support.
You can do this easily via javascript :
http://www.webdevelopersnotes.com/tutorials/javascript/javascript_image_change_functions.php3

How to add custom component in context menu of datagrid

How to add custom component in context menu of datagrid.Here custom component like one text box with formatting details.
You cannot put components into the context menu. You can only have menuitems that dispatch a menuclick event. Unfortunately the context menu in the flashplayer is lacking a lot of functionality like that.
You might be able to highjack the context menu all together and display some sort of title window on a right click, but I am not sure if this is possible or how you would go about trying to achieve it.

Hide an ASP.NET Menu Item

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.
It would be more straight forward to use
myMenu.Items.RemoveAt(0);
This will remove the first menuitem
myMenu.Items[0].ChildItems.RemoveAt(1);
This will remove the second child of the fist menuitem
myMenu.Items[0].ChildItems[1].ChildItems.RemoveAt(1)
This will remove the second child of the second child of the fist menuitem
Doh! Ok, I figured it out. The correct syntax is (VB.Net):
mnuMyMenu.Items.Remove(mnuMyMenu.Items(1))
myMenu.Items(0).ChildItems.Remove(myMenu.Items(0).ChildItems(1))
If you want to remove a menu item by the menu item Text property, you can use:
myMenu.Items.Remove(myMenu.FindItem("Item Text"))

Resources