Results 1 to 4 of 4

Thread: Sorting Problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    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.

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    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

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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>

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207
    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
  •  



Click Here to Expand Forum to Full Width