asp.net - Is it possible to assign an Id to an asp:MenuItem? -
i have asp:menu has 4 menuitems within it. have been able set id menu whole hyperlinks menuitems same. able identify each 1 using id or similar. possible?
this menu:
<asp:menu id="navigationmenu" runat="server" orientation="horizontal" onmenuitemclick="navigationmenu_onmenuitemclick" cssclass="menu"> <staticmenuitemstyle forecolor="black" cssclass="menuitem" itemspacing="20" /> <staticselectedstyle cssclass="menuitemselected"></staticselectedstyle> <items> <asp:menuitem value="0" text="new" selected="true"></asp:menuitem> <asp:menuitem value="1" text="approved"></asp:menuitem> <asp:menuitem value="2" text="rejected"></asp:menuitem> <asp:menuitem value="3" text="done"></asp:menuitem> </items> </asp:menu> and result in browser second , third menuitems (not selected)
<a class="navigationmenu_1 menuitem navigationmenu_3" href="javascript:__dopostback('navigationmenu','2')" style="border-style:none;font-size:1em;">rejected</a> <a class="navigationmenu_1 menuitem navigationmenu_3" href="javascript:__dopostback('navigationmenu','3')" style="border-style:none;font-size:1em;">done</a> as can see similar. solution this?
we cannot able assign id menuitem
you can "menu object" javascript following pattern.
var mymenu = document.getelementbyid("mymenu");
if inspect rendered html see rendered table (with id mymenu) , 1 element every item.
so can hide/show of elements this:
document.getelementbyid("mymenu").tbodies[0].rows[0].style.display = "none";
here's nice tutorial on table dom elements:
http://www.howtocreate.co.uk/tutorials/javascript/domtables
table
caption childnodes[] thead rows[] cells[] childnodes[] tfoot rows[] cells[] childnodes[] tbodies[] rows[] cells[] childnodes[]
Comments
Post a Comment