I have two ASP.NET Menu controls on a page.
One in my header (tabs) for top level pages, e.g. ~/Default.aspx
And one in my sidebar for sub pages, e
Figured it out with help of related question:
Set item.selected in ASP.NET Menu Control
protected void Page_Load(object sender, EventArgs e)
{
MenuControl.MenuItemDataBound += new MenuEventHandler(MenuControl_MenuItemDataBound);
}
void MenuControl_MenuItemDataBound(object sender, MenuEventArgs e)
{
if (SiteMap.CurrentNode != null)
{
if (SiteMap.CurrentNode.ParentNode.Url == e.Item.NavigateUrl)
{
e.Item.Selected = true;
}
}
}