Sitefinity add class to navigation control template
I have a control template in my navigation widget. I am trying to display a border under the current page. In the control template I get the current node in the control template code behind and add the class to display the border.
hyperLink.Attributes.Add("class", "activePrimary");
The hyperlink is rendered with 2 classes.
<a id="ctl00_NavPrimaryTopPlaceholder_C008_ctl00_ctl00_MenuRadListView_ctrl0_MenuItemHyperLink" class="top" class="activePrimary" href="home">Home</a>
I assume Sitefinity is placing the class="top". How can I append my class after the top?
Thanks in advance.
Bill,
public static class WebHelper public static void AddCssClass(this WebControl control, string cssClass) List<string> classes; if (!string.IsNullOrWhiteSpace(control.CssClass)) classes = control.CssClass.Split(new[] ' ' , StringSplitOptions.RemoveEmptyEntries).ToList(); if (!classes.Contains(cssClass)) classes.Add(cssClass); else classes = new List<string> cssClass ; control.CssClass = string.Join(" ", classes.ToArray()); public static void RemoveCssClass(this WebControl control, string cssClass) List<string> classes = new List<string>(); if (!string.IsNullOrWhiteSpace(control.CssClass)) classes = control.CssClass.Split(new[] ' ' , StringSplitOptions.RemoveEmptyEntries).ToList(); classes.Remove(cssClass); control.CssClass = string.Join(" ", classes.ToArray());