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


I am essentially creating vertical breadcrumbs to create a website navigation for a mobile (iPhone) website. As you click on "Premier League", it works in the same way

Using Asap: Menu Control and Sitemap Data Source I am complying with only the current level links within the sitemap and then your Looking for parents to manually insert the list will be the result of an example at the top of the list: about who we are, what we do, location

  var mi = New MenuItem (); Mi.NavigateUrl = node.Url; Mi.Text = node. Title; Mi.ToolTip = Node. Description; MobileMenu.Items.AddAt (0, mi);  

All this works well and works perfectly, however, it needs to be dynamically styled in the included top menu item in a different background color. "About it" in the above example, there will be a deep bg color compared to 3 items below it.

But there is no clear asset on MenuItem to do this.

How can I dynamically set a style on MenuItem that I am going to position it in position 0?

In reply to this I used the jQuery li: nth-child () method in After setting up a square, after which I use Page.ClientScript.RegisterStartupScript ().

  private const string highlightscript = "& lt; script language = \" javascript \ "& gt; \ n" + "$ (\" ul.top li: nth-child (4) \ "). AddClass (\" menu-fourth \ ");" + "& lt; / script & gt;"; Public Zero AddHighlightScript (String Script, String Name) {Page.ClientScript.RegisterStartupScript (GetType (), Name, Script); }  

If someone has a solution, please share.


Comments