ASP.NET 3.5 Menu Control CSS Help

We have successfully mimic'd the navigation structure at at our test site, (we are currently working on design for this client) using the .NET3.5 menu control.

The one feature of their navigation that we cannot replicate using the menu control is when you click on the Events and Info link, you get the sub pages, Bike Events, Alpine Events, Nordic Events below the Events and Info link.

Is this do-able using the Menu control in ASP.NET 3.5?
Our Menu Control: 
<asp:Menu ID="Menu1" runat="server" Width="180" DataSourceID="SiteMapDataSource1">
                  <ul class="menu">
                  <asp:Label ID="Label1" Runat="server"><%# Eval("Text") %></asp:Label>
                  <ul class="menu">
                  <asp:Label ID="Label1" Runat="server"><%# Eval("Text") %></asp:Label>
                  <StaticSelectedStyle CssClass="xMenuActive" />
                  <DynamicSelectedStyle CssClass="xMenuActive" />

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi there,
I've had a look at the site. The ASP.NET menu is not suitable to replicate that functionality. You can try something similar by setting the menu's "orientation" property to "Vetical, but, in any case, the menu won't "stay down".
The best solution to achieve this, I think, would be to use a table and populate it on demand, when the users click on a "menu" item.
jn148Author Commented:
Thanks Juan - a bit of a disappointment that we cannot accomplish it, but oh well...

I am pretty sure we can do some onclick methods that write to a label control to change the look of the 'menu' to re-create the active page look (different background color, indent, etc...) but any advice you could offer on how to make the mouse-over actions work? (each menu item changes background color as you mouse over each item?)

Sure, you can always add attributes to your controls, be them Labels, TableCells, et.
It works basically like this:


And so on...

As you can see, any Javascript attribute can be added to the control.

I hope this helps,

Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

jn148Author Commented:
Thanks - Juan!

Sounds totally perfect, but alas, I am still a newbie at this, and am not quite sure what you mean here?

I did a little research here, and came up with
But their suggestions do not work at all.

Would you be willing to discuss in a litte more detail?
No problem att all JN,
Just let me know exactly what's not working, and what would you like to explore in more detail.
jn148Author Commented:
Thanks a ton Juan!

I guess just the uber-basics of it really...

Where/how do I put the code snippet you provided:

To make the Label1 control I have on the page have the 'hover' characteristics.
I was giving you an example of how you can add css attributes to a control.
Label1 is just an example, but it could be any WebControl.

Have a look at this snippet to see what I mean:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
'Code Behind:
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Label1.Attributes.Add("onmouseover", "'yellow'")
        Label1.Attributes.Add("onmouseout", "'red','white'")
    End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jn148Author Commented:

Thanks for taking the time to work with a newbie Juan - MUCH appreciated!

All of the books I have been reading are so into the onClick method for all of the controls they are teaching that I always forget about that beautiful Page_Load option.

...and for those reading this post in the future: if you want to change the CSS Class, not just a style attribute, use this code:
--- --- ---
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Label2.Attributes.Add("onmouseover", "this.className='xLabelRollover'")
        Label2.Attributes.Add("onmouseout", "this.className='xMenuActive'")
    End Sub
--- --- ---
WARNING: the capitalization of the "N" in this.className= is REQUIRED.

Thanks again Juan!
jn148Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.