Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET menu
Hello Friends,
 
I have created a website in asp.net.
 
i have designed a menu for it...such as Home, AboutUs, Services , Our mission, Contact us.
 
So when i click this menu...Suppose if i click services. the back ground color should change on mouse over and the color should stay on that page...so that the user thinks that he is viewing services page.
 
Please help thanks
 

This is my Menu Css
 
.green #slatenav
{
    position:relative;
 display:block;
 height:42px;
 font-size:12px;
 font-weight:bold;
 
width:48%;
 background-color:#EFCC00;
 
font-family:Arial,Verdana,Helvitica,sans-serif;
/*text-transform:uppercase; */
    top:0px;
 

}
 
.green #slatenav ul{margin:0px;padding:0;list-style-type:none;width:auto; }
.green #slatenav ul li{display:block;float:left;margin:0 1px 10px 8px;}
.green #slatenav ul li a{display:block;float:left;color:#197E46;text-decoration:none;padding:14px 10px 0 10px;height:28px;
 
 -moz-border-radius:20px;}
 
.green #slatenav ul li a:hover,.green #slatenav ul li a.current
{color:#fff;background:transparent url(images/greenslate_backgroundOVER.gif) no-repeat top center;}
 

 
<div class="green">
    <div id="slatenav">
    <ul>
 
            <li><a href="Home.aspx"><span>Home</span></a></li>
            <li><a href="AboutUs.aspx"><span>About Us</span></a></li>
            <li><a href="Services.aspx"><span>Services</span></a></li>
           <li><a href="OurMission.aspx><span>Our Mission</span></a></li>
           <li><a href="ContactUs.aspx"><span>Contact Us</span></a></li>
 
    </ul>
    </div>
      </div>
 

 
Please help thanks.....The bg color should stay on that menu when the user clicks on the menu.
Posted 25-Dec-12 1:58am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I assume that you want to retain the menu color after click. Have a look at following link from ASP.Net forum. Same issue has been addressed:
http://forums.asp.net/t/1595158.aspx/1[^]
Another:
http://stackoverflow.com/questions/6216929/asp-net-selected-menu-item-does-not-retain-selected-backcolor[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 26 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100