Set item.selected in ASP.NET Menu Control

Posted by BillB on Stack Overflow See other posts from Stack Overflow or by BillB
Published on 2010-05-05T01:27:11Z Indexed on 2010/05/05 2:08 UTC
Read the original article Hit count: 283

Filed under:
|

ASP.NET newbie here. When on a page I'd like to set the corresponding menu item to selected. My approach is this: On Home.aspx.cs:

Menu menu = (Menu)Master.FindControl("Menu1");

        if (menu.Items.Count > 0)
        {
            menu.FindItem("Home").Selected = true;
        }

Trouble is, menu.item.count == 0. My menu is bound to a sitemap, if that matters.

Thanks, Bill

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about menu