Click here to Skip to main content
12,694,691 members (32,910 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
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....
Posted 15-May-12 1:26am
Prabhat Kr. Singh 15-May-12 12:26pm
Are you using asp:menu??
Rate this: bad
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" />

Here define DynamicSelected and StaticSelected classes in your css file and set the style you want the menu to have when selected..
Rate this: bad
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 -[^])

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

Hope this helps! If any questions drop in a comment!

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 15 May 2012
Copyright © CodeProject, 1999-2017
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