You can create a hierarchical panelbar in the following ways:
- by defining the hierarchical structure inline;
- programmatically, by using the server-side API;
- by binding to a hierarchical data source control;
- by binding to a non-hierarchical data source with a DataFieldID / DataFieldParentID relation.
Define the hierarchy inline
You do not need to set any property of the panelbar to make it hierarchical. Simply arrange the items hierarchically when defining the panelbar through the ASPX.
A panelbar control has an Items property that represents its items. You can add items to this collection; any item from this collection can also have its own Items collection. Thus you build the hierarchy of items rendered by the panelbar.
Example
The example below illustrates a hierarchical panelbar with up to three levels for some items. ASPX:
| |
Copy Code |
|
<rad:RadPanelBar ID="RadPanelBar1" runat="server"> <Items> <rad:RadPanelItem runat="server" Text="Root RadPanelItem"> <Items> <rad:RadPanelItem runat="server" Text="Child RadPanelItem"> <Items> <rad:RadPanelItem runat="server" Text="Child RadPanelItem"> </rad:RadPanelItem> <rad:RadPanelItem runat="server" Text="Child RadPanelItem"> </rad:RadPanelItem> </Items> </rad:RadPanelItem> <rad:RadPanelItem runat="server" Text="Child RadPanelItem"> </rad:RadPanelItem> </Items> </rad:RadPanelItem> <rad:RadPanelItem runat="server" Text="Root RadPanelItem"> </rad:RadPanelItem> </Items> </rad:RadPanelBar> |
Bind to a hierarchical data source
If bound to a hierarchical data source, the Telerik RadPanelBar will appear multi-level. You do not need to set any additional properties.
To learn more, see SiteMapDataSource control.
See Hierarchical data binding and Data Bindings.
See Also