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
    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.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 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