Austin Muts

Austin Muts

  • 1.3k
  • 312
  • 119.5k

Highlighting Current Page in ASP.NET Master Page

Nov 25 2015 8:20 AM
 If i write my menu like
<li><a runat="server" href="#nogo1" <span>Home</span></a></li>   
then highlighting current page works
but if i write my menu like  
 <li><a runat="server" href="~/Default" <span>Home</span></a></li>
then highlighting stops working but this is the way i want
 
Can someone pliz help 
 
I have this JQUERY
 
 $(document).ready(function () {
            $('.topmenu a').click(function () {
                $(".topmenu a").removeClass("item_active");
                $(this).addClass('item_active');
            });
        });</script>
 
My Css like this
 
.topmenu {
height:37px;
border:0;
margin:0;
}

.topmenu ul,.topmenu ul li {
list-style:none;
float:left;
margin:0;
padding:0;
}

.topmenu ul {
float:right;
margin:57px 0 0;
}

.topmenu ul li a {
background:url(images/right_798a701.png) right top no-repeat;
text-decoration:none;
display:block;
float:left;
border:0;
margin:0 5px 0 0;
padding:0;
}

.topmenu ul li a span {
display:block;
background:url(images/left_798a701.png) left top no-repeat;
font-family:"Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:13px;
color:#fff;
line-height:40px;
font-weight:400;
font-style:normal;
text-decoration:none;
padding:0 15px;
}

.topmenu ul li a:hover,.topmenu ul li a.item_active {
background:#FF0000; 
}

.topmenu ul li a:hover span,.topmenu ul li a.item_active span {
background:#FF0000; 
font-weight:400;
font-style:normal;
text-decoration:none;

}
 
 

Answers (2)