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

Loading PanelBar with FK Related Tables?

1 Answer 38 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Ronnie
Top achievements
Rank 1
Ronnie asked on 05 Dec 2009, 06:18 AM
Hello,

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();  
depts.Load();  
  
pnlbarDepartments.DataSource = depts;  
pnlbarDepartments.DataTextField = "DisplayText";  
pnlbarDepartments.DataValueField = "ID";  
pnlbarDepartments.DataBind(); 

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 ?
OR
Is there an alternative way of doing this ?

Thank you in advance,
Ronnie

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Dec 2009, 02:34 PM
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.
Tags
PanelBar
Asked by
Ronnie
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or