Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 15-May-12 1:26am
Comments
Prabhat Kr. Singh at 15-May-12 12:26pm
   
Are you using asp:menu??
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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" />
</asp:menu>
 
Here define DynamicSelected and StaticSelected classes in your css file and set the style you want the menu to have when selected..
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 - 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!
  Permalink  
v3

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



Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100