This is a migrated thread and some comments may be shown as answers.

Nested databinding question

1 Answer 69 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 03 May 2008, 08:48 PM
Hey everyone,

I'm trying to databind some elements to data to the Panel Bar in the following format:

  • Top Category 1
    • sub cat 1
    • sub cat 2
    • sub cat 1
    • sub cat 2
  • Top Category 2
But I haven't been able to find any resources in the help docs.  Could anyone point me in the right direction?  This is what I have so far:

                    <telerik:RadPanelBar ID="rpbMainNav" runat="server" DataTextField="Name" DataValueField="Id" OnItemDataBound="rpbMainNav_ItemDataBound" Skin="Web20" ExpandMode="SingleExpandedItem" PersistStateInCookie="True">
                        <CollapseAnimation Duration="100" Type="None" />
                        <ExpandAnimation Duration="100" Type="Linear" />                                               
                        <ItemTemplate>
                             <%# BuildStoreList(DataBinder.Eval(Container.DataItem, "Id")) %>
                        </ItemTemplate>
                    </telerik:RadPanelBar>

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 05 May 2008, 06:36 AM
Hi Joel,

You can establish hierarchy through ID to ParentID relationship using:

DataFieldID - The name of the DataColumn holding the ID value.
DataFieldParentID - The name of the DataColumn holding the ParentID value. The id of the root items should be null.

I suggest you review the following online resources: Hierarchical Data Binding and Binding to Hierarchical DataSource Components


Kind regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
PanelBar
Asked by
Joel
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or