c# - Web Usercontrol menu item dynamic selected style not working -
i have web user control,it include menu.it have 4 menu items,i using style sheet dynamic , static selected style.but static , dynamic selected style not working.how solve problem
2, codebehind of menuitemclick event:
protected void menu1_menuitemclick(object sender, menueventargs e) { session["selected"] = e.item.text; if (e.item.text == "page1") { response.redirect("~/menu/default.aspx"); } else if(e.item.text == "page2") { response.redirect("~/menu/default2.aspx"); } else if (e.item.text == "page3") { response.redirect("~/menu/default3.aspx"); } }
page load on user control
protected void page_load(object sender, eventargs e) { if (session["selected"] != null) { (int = 0; < this.menu1.items.count; i++) { if (this.menu1.items[i].text == session["selected"].tostring()) { this.menu1.items[i].selected = true; } } } }
Comments
Post a Comment