asp.net - Applying Css Style to Asp:Menu MenuItem -



asp.net - Applying Css Style to Asp:Menu MenuItem -

i'm creating vertical breadcrumb create website navigation mobile (iphone) website. similar maybe how http://news.bbc.co.uk/sport1/hi/football/default.stm works click "premier league"

using asp:menu command , sitemapdatasource binding current levels links within sitemap , finding parent manually insert @ top of list. illustration resulting nav be: about, we, do, locations

var mi = new menuitem(); mi.navigateurl = node.url; mi.text = node.title; mi.tooltip = node.description; mobilemenu.items.addat(0, mi);

this fine , works perfectly. however, dynamically inserted top menuitem needs styled in different background colour. in illustration above "about" have darker bg colour 3 items below it.

but there isn't kind of obvious property on menuitem this.

how dynamically set style on menuitem inserting position 0?

in reply used jquery li:nth-child() method set class li after utilize page.clientscript.registerstartupscript().

private const string highlightscript = "<script language=\"javascript\">\n" + "$(\"ul.top li:nth-child(4)\").addclass(\"menu-fourth\");" + "</script>"; public void addhighlightscript(string script, string name) { page.clientscript.registerstartupscript(gettype(), name, script); }

if else has solution please share.

asp.net css menuitem aspmenu-control

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -