+1-888-365-2779
Try Now
More in this section

Forums / Designing & Styling / Sitefinity add class to control template list item

Sitefinity add class to control template list item

1 posts, 0 answered
  1. Bill
    Bill avatar
    2 posts
    Registered:
    15 Feb 2012
    24 Jul 2012
    Link to this post
    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.
1 posts, 0 answered