Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have several links in my master page Home contact Help, and i have added three content pages Home.aspx,contact.aspx and help.aspx added to links in master page . how to highlight selected link, for example when i click Home i want to highlight Home like contact help also


my code is

masterpage.master

<form>

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</form>
Posted

1 solution

Hi,

There will be one style available called Hover property, you can use that. Change the background color in that property.

(Ex)
Here HomeMenu is my Menu item name. Post this below code in your style sheet.

HTML
#HomeMenu:hover
{
    background: #0066CC;
}


Refer this below link,

http://stackoverflow.com/questions/17060426/how-to-highlight-active-page-in-a-masterpage-menu[^]

Regards,
BlueSathish
 
Share this answer
 
v3
Comments
Member 11382784 20-Jan-15 1:58am    
i have used that, when am clicking link it is showing color but after page redirecting the link is not highlighting ..

my code masterpage.master


<title></title>
<style type="text/css">
.menu_div ul
{
padding: 6px;
margin: 0px;
font-size: 12px;
list-style: none;
text-indent: 15px;
}
.menu_div ul li
{
line-height: 28px;
border-bottom: 1px solid #000;
}
.menu_div ul li a
{
text-decoration: none;
font-color: #3A332D;
display: block;
}
.menu_div ul li a:hover
{
background: blue;
}
.menu_div ul li#active
{
background: blue;
}
</style>
<asp:ContentPlaceHolder ID="head" runat="server">

</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<div class="menu_div">
<ul>
<li>Home</li>
<li>Contact</li>
<li>Help</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</form>
</body>
bluesathish 20-Jan-15 2:09am    
check the link I've posted in my updated solution. Hope it'll help you.
Member 11382784 20-Jan-15 2:23am    
it showing color while am clicking, after page redirecting it is not showing any color

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900