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

Rad TreeView Relational Data binding from database

8 Answers 377 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Mahitha Madala
Top achievements
Rank 1
Mahitha Madala asked on 22 Sep 2009, 09:50 AM
hi,

I am trying for binding a Relational data from the database to Rad TreeView control.
Ihave taken a Dept table (primary Key table) , Employee table (related with a foriegn key to Dept table and itself has a primary Key column) and Products table (related with a foriegn key to Employee table).
I have tried using RelationBindings.Add() methods but, i didn't get the result.

Please can u tell me how to bind a relational data to a Rad treeview control.

Thank you,

regards,
Mahitha Madala.

8 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 25 Sep 2009, 12:31 PM
Hi Mahitha,

Thank you for writing.

Here is an example of how to bind RadTreeView to related tables of the Northwind database.
Assuming you have a NorthwindDataSet and the Orders and Customers tables are filled properly, the code looks like this:
RelationBinding binding = new RelationBinding("FK_Orders_Customers"this.northwindDataSet.Orders); 
binding.DisplayMember = "OrderID"
this.radTreeView1.RelationBindings.Add(binding); 
this.radTreeView1.DisplayMember = "ContactName"
this.radTreeView1.DataSource = this.northwindDataSet.Customers; 

Write again if you have other questions.

Sincerely yours,
Victor
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.
0
Mahitha Madala
Top achievements
Rank 1
answered on 05 Oct 2009, 11:15 AM
hi,

For binding relational data to a Rad tree view i have assigned the datasource by connecting the database , selecting the required tables and using the following code.

 

 

Dim

binding As New RelationBinding("FK_Orders_Customers", Me.FKEmpTableDepartmenttableBindingSource)

 

 

Me.RadTreeView1.RelationBindings.Add(binding)

 

 

 

Me

.RadTreeView1.DataSource = Me.TestRadDatabaseDataSet1.Department_table

 

 

                                        (another way)

 

Me

.RadTreeView1.DataSource = Me.DepartmenttableBindingSource

 

 

Me.RadTreeView1.RelationBindings.Add(New RelationBinding("ArtistsAlbums", Me.Emp_TableTableAdapter.))

 

 

Me.RadTreeView1.RelationBindings.Add(New RelationBinding("AlbumsSongs", Me.FKProductsEmpTableBindingSource))

 

 

Me.RadTreeView1.RootRelationDisplayName = "Artists"

 In the above senario i can see only the parent table information displayed in the treeview but not the child tables informations.

Please can anyone suggest any other way or any other properties to be set.

thank you,

regards,
Mahitha Madala.

 

0
Victor
Telerik team
answered on 08 Oct 2009, 03:18 PM
Hello Mahitha,

In order to bind RadTreeView to related data tables you must make sure that your RelationBinding objects are created correctly and that you have set the proper DataTable as the DataSource for RadTreeView.

For example, in the Northwind context with the Orders and Customers tables the binding will look like this:
Dim ordersCustomers As RelationBinding = New RelationBinding("FK_Orders_Customers", Me.NorthwindDataSet.Orders)
ordersCustomers.DisplayMember = "OrderID"
   
Me.RadTreeView1.RelationBindings.Add(ordersCustomers)
   
Me.RadTreeView1.DisplayMember = "ContactName"
Me.RadTreeView1.DataSource = Me.NorthwindDataSet.Customers
Me.RadTreeView1.RootRelationDisplayName = "Customers"
Write again if you have other questions.

Sincerely yours,
Victor
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.
0
Mahitha Madala
Top achievements
Rank 1
answered on 09 Oct 2009, 05:49 AM
hey,

Its working. Its great,  thanks  for all your replies.

regards,
Mahitha Madala
0
rashmi balakrishnan
Top achievements
Rank 1
answered on 20 May 2010, 09:59 AM
Hi,

Is it possible to bind RAD Tree Control to a MDX query.
Please provide an example/demo.


Thanks n Regards,
Rashmi
0
Victor
Telerik team
answered on 25 May 2010, 02:18 PM
Hi rashmi balakrishnan,

Thank you for the question.

RadTreeView currently does not officially support multi-dimensional data sets and has not been tested in such a scenario. If the result of your MDX query supports the IList interface, RadTreeView will have no troubles generating a view for the data, but it is not guaranteed that the result will look intuitive.

Write again if you have other questions.

Sincerely yours,
Victor
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.
0
Willem
Top achievements
Rank 1
answered on 08 Sep 2010, 03:53 PM
is this binding read and write?

If it is also a writing binding does it support drag and drop?
0
Jack
Telerik team
answered on 14 Sep 2010, 01:51 PM
Hello Willem,

Thank you for this question. Yes we support drag & drop, however RadTreeView does not modify the underlying data source. Its purpose is only to display the data. If you have further questions, please do not hesitate to write back.

All the best, Jack
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
Mahitha Madala
Top achievements
Rank 1
Answers by
Victor
Telerik team
Mahitha Madala
Top achievements
Rank 1
rashmi balakrishnan
Top achievements
Rank 1
Willem
Top achievements
Rank 1
Jack
Telerik team
Share this question
or