Sitefinity add class to control template list item - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Sitefinity add class to control template list item

  • Sitefinity add class to control template list item
  • I am trying to add a class to a Sitefinity control tmeplate list item.


                 if (hyperLink.NavigateUrl == currentNode.Url)
                   
                        m_log.Debug("    Item is current");
                        classValue = hyperLink.Attributes["class"];
                        hyperLink.Attributes.Remove("class");


                        
                        if (!string.IsNullOrEmpty(classValue))
                       
                            if (classValue.IndexOf("activeVerticalNav") == -1)
                           
                                classValue += " activeVerticalNav";
                           
                       
                        else
                       
                            classValue = "activeVerticalNav";
                       
                        hyperLink.Attributes.Add("class", classValue);




    I can style the hyperlink in the control template, but the the hyperlink's parent.


    I tried to cast the RadListViewDataItem to HtmlGenericControl to add a class, but this does not work.


    HtmlGenericControl hyperLinkLi = (HtmlGenericControl) hyperLink.Parent;


    How can I add a class to the list item?


    Thanks in advance.