ASP.NET - Highlight the menu item .. - Asked By Hari krishna s on 08-May-12 07:21 AM

how to do  highlight the menu control after click the item in asp.net using css styles...
plz send the code...Thanks In adv..
dipa ahuja replied to Hari krishna s on 09-May-12 07:15 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>

[)ia6l0 iii replied to Hari krishna s on 09-May-12 10:23 AM
You need to use the "StaticSelectedStyle" element to style the selected menu items. Here's a sample.

<asp:Menu>
...
<staticselectedstyle backcolor="Gray" bordercolor="Red" borderstyle="Solid"  borderwidth="2"/>
...
</asp:Menu> 


Also, note that you should not set the "IncludeStyleBlock" property to false - which means that you will provide the styles for the selected items. 

Hope this helps.