Click here to Skip to main content
14,878,819 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# 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....
Prabhat Spark 15-May-12 12:26pm
Are you using asp:menu??

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

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 -[^])

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

Hope this helps! If any questions drop in a comment!
I think you haven't set the SelectedStyle property of static and dynamic MenuItems

Do it like this..
<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" />

Here define DynamicSelected and StaticSelected classes in your css file and set the style you want the menu to have when selected..

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