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

Forums / Developing with Sitefinity / Apply different classes to panel items

Apply different classes to panel items

2 posts, 0 answered
  1. Anthony Smith
    Anthony Smith avatar
    34 posts
    Registered:
    08 Dec 2009
    06 Feb 2010
    Link to this post
    I'm looking to implement a panel bar with different classes applied to the indidual items for example:

    Item 1 [.green]
    Item 2 [.blue]
    Item 3 [.red]
        Item 3a [.light red]
        Item 3b [.light red]
    Item 4 [.pink]

    Can you advise me how I would go about implementing this.

    Thanks,
    Tony.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    07 Feb 2010
    Link to this post
    Hi Anthony Smith,

    RadPanelItem object has a property CssClass that you can set. You can get the items OnPreRender or ItemDataBound and set desired css class

    sample code

    public void RadPanelbar1_ItemDataBound(object sender, RadPanelBarEventArgs e)
     {
         if (e.Item.Text == "Item1")
         {
             e.Item.CssClass = "item1Css";
         }
           ....
               ....
     }


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
2 posts, 0 answered