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

Binding to a dataset with multiple tables

1 Answer 154 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 01 Jun 2010, 01:17 PM

I've spent some time trying to bind a dataset to a treeview where there are three tables each with a different set of columns.

Three tables; Customer, Order and LineItem

Customer [CustomerId, Name]
Order [OrderId, CustomerId, OrderReference]
LineItem [LineItemId, OrderId, ProductName, Quantity]

The theory was... Create a Dataset with apporpriate relations and bind it server side. However it doesn't seem to work - I only can see the top level and if as I specify the DataMember attribute, It doesn't even use the name property to set the text.

Any help appreciated. Is the only solution to create the nodes server side programatically and add them to the tree?

 

 

<telerik:RadTreeView ID="treeCustomer" runat="server">

 

 

 

<DataBindings>

 

 

 

<telerik:RadTreeNodeBinding Depth="0" TextField="Name" ValueField="CustomerId" DataMember="Customer" />

 

 

 

<telerik:RadTreeNodeBinding Depth="1" TextField="OrderReference" ValueField="OrderId" DataMember="Order" />

 

 

 

<telerik:RadTreeNodeBinding Depth="2" TextField="ProductName" ValueField="LineItemId" DataMember="LineItem" />

 

 

 

</DataBindings>

 

 

 

</telerik:RadTreeView>

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 04 Jun 2010, 11:11 AM
Hi Paul,

I took some time to create an example for you - it's attached to the post.

In the example the RadTreeView is bound to SqlDataSource (not to a DataSet), which should be the easiest way to do it.

If you still want to go for DataSet, then yes, this is the only way - extract nodes data, create nodes and add them to the tree structure.

Hope this is going to help you!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
Paul
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Share this question
or