Hi,
I have an ASP.NET / C# application in which the Master Page contain the main menu of my application and several content pages that depend of this master page.
I would like to highlight the menu link of my master page corresponding to the current content page displayed.
To do that, I already have a CSS class dedicated to this (called "selected")
Thus, I was trying to access the Master Page link I want to highlight from the content page by using its ID and do something like that (in the content page) :
HtmlLink currentMenu = (HtmlLink) Master.FindControl("idOfTheLinkToHighlight");
currentMenu.Attributes.Add("class", "selected");
But I get the following exception :
Unable to cast object of type 'System.Web.UI.HtmlControls.HtmlGenericControl' to type 'System.Web.UI.HtmlControls.HtmlLink
Can anybody help me on this ? Thanks