Nested databinding question

2 posts, 0 answers
  1. Joel
    Joel avatar
    1 posts
    Member since:
    Dec 2007

    Posted 03 May 2008 Link to this post

    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!
  2. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 05 May 2008 Link to this post

    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
Back to Top