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

Dataset databinding question

2 Answers 67 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gene
Top achievements
Rank 1
Gene asked on 19 Mar 2009, 10:43 PM
I'm having trouble binding a dataset to a treeview, and am hoping to get some help.

I have a dataset that essentially flattens a couple of relational tables (Biz Segments, Biz Units, and Facilities).

The dataset look like:

 BizSegmentID,BizSegmentName,BizUnitID,BizUnitName,FacilityID,FaciliyName
1,SegA,1,UnitA,1,FacilityA
1,SegA,1,UnitA,2,FacilityB
1,SegA,2,UnitB,3,FacilityC
1,SegA,2,UnitB,4,FacilityD
2,SegB,3,UnitC,5,FacilityE
2,SegB,3,UnitC,6,FacilityF

I want the tree to look like:

-SegA
    --UnitA
        ---FacilityA
        ---FacilityB
    --UnitB
        ---FacilityC
        ---FacilityD
-SegB
    --UnitC
        ---FacilityE
        ---FacilityF

What is the best way to go about binding the tree to this type of dataset?

Thanks in advance,
Gene.

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 20 Mar 2009, 08:09 AM
Hello Gene,

I think RadTreeView cannot automatically bind to this type of data. What it can bound to is self referencing tables. Please check this help article for additional info.

All the best,
Albert
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gene
Top achievements
Rank 1
answered on 23 Mar 2009, 07:33 PM
Thanks for the response Albert.

We ended up refactoring the DataSet into a Parent/Child structure (below) and binding to that.

nodeID, parentID, name
bs.1, null, SegA
bu.1, bs.1, UnitA
fs.1, bu.1, FacilityA
fs.2, bu.1, FacilityB
bs.2, null, SegB
bu.2, bs.2, UnitB
bu.3, bs.2, UnitC
etc.

The short of it is that we concatenate an "identifier" to the primarykey and use that to differentiate the different heirarchies.

Perhaps you guys could put a couple more attibutes on the treeview to differentiate a node's type and parent type for the different branches of your tree.

Thanks again!
Gene
Tags
TreeView
Asked by
Gene
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Gene
Top achievements
Rank 1
Share this question
or