Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends:
I am using master-page in my c# asp.net Project. I have to highlight Selected menu item in master page in that i tried Static menu selected style and Dynamic Selected Menu style that are all not working from child pages how to do that please help me....
Posted
Comments
Prabhat Spark 15-May-12 12:26pm    
Are you using asp:menu??

I think you haven't set the SelectedStyle property of static and dynamic MenuItems

Do it like this..
ASP.NET
<asp:menu id="menuBar" runat="server" orientation="Horizontal" width="100%" xmlns:asp="#unknown">
      <dynamichoverstyle cssclass="DynamicHover" />
      <dynamicmenuitemstyle cssclass="DynamicMenuItem" />
      <dynamicselectedstyle cssclass="DynamicSelected" />
                   
      <statichoverstyle cssclass="staticHover" />
      <staticmenuitemstyle cssclass="StaticMenuItem" itemspacing="1px" />
      <staticselectedstyle cssclass="StaticSelected" />
</asp:menu>


Here define DynamicSelected and StaticSelected classes in your css file and set the style you want the menu to have when selected..
 
Share this answer
 
Assuming you are asking for a "webforms" solution, given below is one way of how you could achieve this:

1. Have a method in your master page that the content pages can call

C#
public partial class MyMaster : ....
{
     public void SelectIcon(string someParameter)
     {
            // add the class to the icon / link text to make it selected
     }
}


2. Add MasterType header in your content pages (reference - http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx[^])

3. Call the method in content page's code-behind like Master.SelectIcon

Hope this helps! If any questions drop in a comment!
 
Share this answer
 
v3

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