Menu - 06-18-2007 , 01:58 PM
I am tring to get the menu control to do some things, but have had problems
trying to do what I want to do.
1.) Why is there underlines under each menu item? How do I get rid of these?
I've tried to use style sheets but they don't work.
2.) I want the sub menu items to have a link and when somebody clicks on the
link to go there, and this works just fine. What I don't want to happen is
when they click on a parent menu item, I don't want it to do anything other
than open up the sub menu below it.
Is there any work arounds? I'm finding the menu hard to use and it should be
Re: Menu - 06-20-2007 , 08:38 AM
On Jun 18, 1:58 pm, Chris Davoli
<ChrisDav... (AT) discussions (DOT) microsoft.com> wrote:
occurring for you. I cannot reproduce this. When I create a project
with just a menu in it, and nothing else, the menu items are not
underlined because .Net puts styles directly into the page preventing
that. I have a feeling that you are overriding the style somewhere in
your code, which is causing the underline.
For your second problem, this is incredibly easy to do. Every
MenuItem has a "Selectable" property. You just need to set that for
your top level items to false. If you are adding menu items in
your .aspx, it is as simple as this:
<asp:Menu runat="server" ID="mnuTest">
<asp:MenuItem NavigateUrl="" Text="Test1" Selectable="False">
<asp:MenuItem NavigateUrl="test2.html" Text="Test2" />
<asp:MenuItem NavigateUrl="test3.html" Text="Test3" />
If you are using databinding in the code behind, you need to add an
OnMenuItemDataBound event and then handle setting that property in the
<asp:Menu runat="server" ID="mnuTest"
protected void mnuTest_MenuItemDataBound(object sender, MenuEventArgs
if (e.Item.Depth == 0)
e.Item.Selectable = false;
I would like to note, however, that it isn't the best usability to
have a menu where your top level nodes are not clickable. If someone,
for whatever reason, can't get the scripting to work to get your
second level to display, then they cannot get anywhere in your site.
|Thread Tools||Search this Thread|