HighTechTalks DotNet Forums  

Menu

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Menu in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?Q2hyaXMgRGF2b2xp?=
 
Posts: n/a

Default 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
easy.

Chris

Reply With Quote
  #2  
Old   
charles.boyung@gmail.com
 
Posts: n/a

Default Re: Menu - 06-20-2007 , 08:38 AM






On Jun 18, 1:58 pm, Chris Davoli
<ChrisDav... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
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
easy.

Chris
For your first problem, please provide a sample where this is
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">
<Items>
<asp:MenuItem NavigateUrl="" Text="Test1" Selectable="False">
<asp:MenuItem NavigateUrl="test2.html" Text="Test2" />
<asp:MenuItem NavigateUrl="test3.html" Text="Test3" />
</asp:MenuItem>
</Items>
</asp:Menu>

If you are using databinding in the code behind, you need to add an
OnMenuItemDataBound event and then handle setting that property in the
event handler:
<asp:Menu runat="server" ID="mnuTest"
OnMenuItemDataBound="mnuTest_MenuItemDataBound" />

protected void mnuTest_MenuItemDataBound(object sender, MenuEventArgs
e)
{
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.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.