|
-
Apr 17th, 2003, 09:24 AM
#1
Thread Starter
Addicted Member
Sorting Problem
Hello,
I seem to have developed a smalll issue. In a dataset I have some data that looks something like this.
ID_________Parent Item_____Text
1__________RootID#________Item1
2__________RootID#________Item2
3__________1_____________ItemA
4__________1_____________ItemB
5__________2_____________ItemC
6__________3_____________ItemZ
What i would like to do is create a treeview from the dataset that looks like this
Root
>Item1
>>ItemA
>>>ItemZ
>>ItemB
>Item2
>>ItemC
Any help would be appreciated.
Jeremy
Last edited by Jeremy Martin; Apr 18th, 2003 at 12:55 AM.
-
Apr 18th, 2003, 12:06 AM
#2
Frenzied Member
Are you sure thats what you want? There is some inconsistency in your data. For example you have put Item1 and ItemB in the same level whose parent item is different in dataset, and put ItemA and ItemB in different levels while thier parent item is the same. What is your rule for puting items in root and subsequent nodes?
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 18th, 2003, 12:43 AM
#3
If you want to preserve the heirarchy of the data I'd store it in XML that way then use the XMLDocument object instead of the Dataset to navigate it.
<Root>
<Item Name="Item1">
<Item Name="ItemA"/>
<Item Name="ItemZ"/>
</Item>
<Item Name="ItemB ">
<Item Name="ItemC"/>
</Item>
</Root>
-
Apr 18th, 2003, 12:56 AM
#4
Thread Starter
Addicted Member
Originally posted by Lunatic3
Are you sure thats what you want? There is some inconsistency in your data. For example you have put Item1 and ItemB in the same level whose parent item is different in dataset, and put ItemA and ItemB in different levels while thier parent item is the same. What is your rule for puting items in root and subsequent nodes?
Right typeo on my part i fixed the "tree" to what I want it to look like. I would store the information in a xml file except i am actually getting the dataset from a sql server and the data has to remain there as it is part of another program.
Jeremy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|