ASP.NET - menu colour - Asked By msakt on 30-Mar-12 08:52 AM

i have menu like this

home  aboutus    carrier

if i click home ..home link color will be set different
dipa ahuja replied to msakt on 30-Mar-12 08:58 AM
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<cc1:HoverMenuExtender ID="HoverMenuExtender2" runat="Server" PopupControlID="sub"
PopupPosition="bottom" TargetControlID="lnkSub" PopDelay="25" Enabled="true" />



 
<table bordercolor="black" cellpadding="0" cellspacing="0" id="t" border="0" runat="server"
bgcolor="#4A669C">
<tr><td height="20px" backcolor="blue" style="width44px">
<asp:LinkButton ID="lnkHome" Text="Home" ForeColor="White" runat="server" PostBackUrl="Default.aspx" />
</td>
<td height="20px" width="100">
<asp:LinkButton ID="lnkSub" ForeColor="White" runat="server" PostBackUrl="#" Text="Subject"/>
</td></tr>
</table>
 
<table runat="server" id="sub" bgcolor="#E2E9F1" width="100">
<tr><td><a href="#">ASP.NET</a><br /><a href="#"> C#</a>
<br /><a href="#">VB.NET</a><br /><a href="#">J#</a><br />
</td></tr>
</table>

Somesh Yadav replied to msakt on 30-Mar-12 09:01 AM
HI,

check this,
http://www.codeproject.com/Articles/42717/Menu-Control-Selected-Item-Color-Change-Depending

http://msdn.microsoft.com/en-us/library/ecs0x9w5%28v=vs.80%29.aspx
kalpana aparnathi replied to msakt on 30-Mar-12 09:13 AM
hi,

Do you want it using .css file? if so,then use  below example code:

 .menu a 
{
 background
:#ffffff;
  color
:#ff0000;
  position
: static ;
  display
: block;
  text
-decoration: none;
  min
-width:50px;
   padding
: none;
 
 
}
 
.menu a:hover
{
  background
:#ff0000;
color
:#ffffff;
 padding
: none;
 
}
.menu a:active
 
{
   background
:#ff0000;
   color
:#ffffff;
   padding
: none;
 
}

 
and then you can just add

for static menu or main menu


<
StaticMenuStyle CssClass="menu" />

for dynamic menu or sub menu

<DynamicMenuStyle CssClass="menu" />