Dataset and Hierarchial Data How to Sort

Posted by mdjtlj on Stack Overflow See other posts from Stack Overflow or by mdjtlj
Published on 2010-06-07T02:06:53Z Indexed on 2010/06/07 2:12 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

This is probably a dumb question, but I've hit a wall with this one at this current time.

I have some data which is hierarchial in nature which is in an ADO.NEt dataset. The first field is the ID, the second is the Name, the third is the Parent ID.

ID NAME Parent ID
1 Air Handling NULL
2 Compressor 1
3 Motor 4
4 Compressor 1
5 Motor 2
6 Controller 4
7 Controller 2

So the tree would look like the following:

1- Air Handling
4- Compressor
6 - Controller
3 - Motor
2- Compressor
7- Controller
5 - Motor

What I'm trying to figure our is how to get the dataset in the same order that ths would be viewed in a treeview, which in this case is the levels at the appropriate levels for the nodes and then the children at the appropriate levels sorted by the name.

It would be like binding this to a treeview and then simply working your way down the nodes to get the right order.

Any links or direction would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about ADO.NET