css - maintain Menu Item selected state -
i have menu in asp.net page.the menuitem , url loading dynamically code behind during ispostback=false
.
after clicked on of menu item, selected item background color changed , after directing url, selected state cleared.
i tried code below , not work.the css class not applied item after postback
dim s2 string = request.querystring("sub") each item menuitem in menu1.items if item.text = s2 item.selected = true exit end if next <asp:menu id="menu1" runat="server" role="tablist" orientation="horizontal" cssclass="nav nav-pills" forecolor="black" renderingmode="list" includestyleblock="false"> <%-- <statichoverstyle cssclass="focus" />--%> <staticmenustyle cssclass="nav nav-pills"/> <staticmenuitemstyle cssclass="mainnavstyle"/> <staticselectedstyle cssclass="active"/> </asp:menu>
html mark after selected. active class there. disappeared after postback or page load
<div role="tablist" class="nav nav-pills" id="ctl00_menu1" style="float: left;"> <ul class="level1 nav nav-pills static" tabindex="0" role="menubar" style="position: relative; width: auto; float: left;"> <li role="menuitem" class="static active" style="position: relative; float: left;">
please take note control menu @ master page , data loaded master page well
Comments
Post a Comment