Telerik
Home / Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / PanelBar / Setting different styles for each level of panel items

Setting different styles for each level of panel items

Article Info

Rating: 1

Article information

Article relates to

RadPanelBar v4.3.4.0

or

RadPanelBar for ASP.NET AJAX
(Telerik.Web.UI v2008.1.x)

Created by

Paul, Telerik

Last modified by

Simeon, Telerik


HOW-TO
Set different styles for each level of panel items in RadPanelBar.

DESCRIPTION
In number of cases it is mandatory to define different visualization settings for each level of panel items. RadPanelBar is powerful enough to accomplish this through CSS.

SOLUTION
You can customize the appearance of RadPanelBar using separate css class definitions for each level of items. All you need to do is build css classes in par with you particular requirements and refer to these css classed through the css style properties (CssClass, ExpandedCssClass, SelectedCssClass, etc.) of the corresponding panel items, for example:

ASPX
        <head runat="server"
            ..... 
            <link href="panelbar.css" rel="stylesheet" type="text/css" /> 
        </head> 
        ..... 
        <telerik:RadPanelbar ID="RadPanelbar1" runat="server"
            <Items> 
                <telerik:RadPanelItem  
                    runat="server"  
                    Text="root"  
                    CssClass="panelbarHeader" 
                    ExpandedCssClass="panelbarHeader" 
                    ClickedCssClass="panelbarHeader"
                    <Items> 
                        <telerik:RadPanelItem  
                            runat="server"  
                            Text="subroot" 
                            CssClass="panelbarItem" 
                            ExpandedCssClass="panelbarItem" 
                            ClickedCssClass="panelbarItem"
                            <Items> 
                                <telerik:RadPanelItem  
                                    runat="server"  
                                    Text="inner" 
                                    CssClass="panelbarInner" 
                                    ExpandedCssClass="panelbarInner" 
                                    ClickedCssClass="panelbarInner"
                                </telerik:RadPanelItem> 
                            </Items> 
                        </telerik:RadPanelItem> 
                    </Items> 
                </telerik:RadPanelItem> 
            </Items> 
        </telerik:RadPanelbar> 

CSS
.panelbarInnerCollapsed 
    FONT-SIZE: 11px
    COLOR: green
    FONT-FAMILY: Arial,Verdana
    cursor: hand; 
    height25px
    padding-left90px
    padding-top6px
 
.panelbarHeaderCollapsed 
{   
    FONT-SIZE: 11px
    COLOR: blue
    font-weightbold
    FONT-FAMILY: Arial,Verdana
    cursor: hand; 
    height35px
    padding-left24px
 
.panelbarItem 
    FONT-SIZE: 11px
    COLOR: red
    font-weightbold
    FONT-FAMILY: Arial,Verdana
    cursor: hand; 
    text-decorationnone
    padding-left60px
    height24px

You can also define your custom background/images for the panel items if you like (simply add them to the respective css class definitions).

Comments

There are no comments yet.
If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2010 Telerik. All rights reserved.