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?
Related
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.
when user clicks on Add button, then a pop up button will be opened with certain form elements (like textinput, date field, text area).. When i used 'TAB' inside this form,it is not working. I found in couple of Questions / forums that we need to create an instance of FocusManager and then bring/activate focus for the pop up. But still i didn't see the tab working inside the form. In order to tab order working inside a pop up, what steps we need to follow.
I tried using focusmanager and property like tabfocusenabled, tabenabled and also added taborder inside each form element. But no luck.
Iam using Flash Builder 4.5 and using spark components for development.
Is there any workaround for this problem?
Thanks in Advance,
Regards
Srinivasan
Thanks for all your responses.
Finally the issue has been solved by one of my colleague. Problem is , the form has been loaded inside Horizontal accordion (flexlib HACCORDION). So inorder to draw focus inside the accordion to child elements, we need to add 'hasFocusableChildren="true"' for the HAccordion (horizontal accordion component). Adding this property solves the tab order problem.
I have also pasted the code below:
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.
Here is my site:
http://wake9.com/blogs/norcal-merced-wakesurfing-competition-2009/.
Notice the menu item "Photos and Results". Hover over it and you will see sub menu items. I want to be able to click on the sub-menu items but the main menu item shouldn't be a page or be clickable. The only way i could get this item on the menu was to make it a page. Is there a way to just have a menu item that has sub menu items to content, but the actual menu item isn't clickable? I was thinking about using JQuery to remove the anchor tag, but that is a real hack and I want to know if there is an easier way.
Thanks in advance!
One option would be to use Page Links to plugin and set the main link as '#' . I tried this and it works in my blog.
What about using the jQuery.remove to remove the element?
something like this:
function removeLinkAttrib() {
var attrib = jQuery(#menus).find("a").attr("Photos and Results");
jQuery(attrib).remove;
}
I'm not sure if $(attrib).remove; will work, but you get the picture :)
(this answer is for people using Wordpress.com free sites):
You can go to Appearance > Menus, then add a custom link to the menu by clicking 'Links' in the left-hand column, and adding "#" as the URL (and whatever you want as a label). Then add this link to the menu. Open the options for the new menu item in 'Menu Structure', and then delete '#' from the URL, so the field is blank, and save changes. Now you can add sub-menus to this menu item, and there will be no link for this item on the main menu...works for me.
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"))