Loading PanelBar with FK Related Tables?

2 posts, 0 answers
  1. Ronnie
    Ronnie avatar
    29 posts
    Member since:
    Oct 2008

    Posted 05 Dec 2009 Link to this post


    I'm trying to bind a Panel Bar with data from 3 tables with Foreign Key relationship.

    Departments  --> Categories   --->    Products
    DepartmentId     CategoryId              ProductId
    Name                 DepartmentId(fk)    CategoryId(fk)
                               Name                     Name

    I access these tables via methods:
    • LoadDepts();
    • LoadCategories(int deptId);
    • LoadProducts(int catId);

    I can bind to the panel bar like this and return a list of departments.  But I'm having problems getting the categories to persist as PanelBarItems.
    Departments depts = new Departments();  
    pnlbarDepartments.DataSource = depts;  
    pnlbarDepartments.DataTextField = "DisplayText";  
    pnlbarDepartments.DataValueField = "ID";  

    I've come aross this post referencing this example explaining manual creation of the panel bar items.  The example shows how to do this using an OleDbDataAdapter.

    How can I create this scenario using my methods ?
    Is there an alternative way of doing this ?

    Thank you in advance,
  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 09 Dec 2009 Link to this post

    Hi Ronnie,

    You can use SqlServerAdapter or any other methods which return data. What you need to do is iterate through your datasource and create the PanelBarItems with the code behind.

    Sincerely yours,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top