View Single Post
  #2 (permalink)  
Old December 23rd, 2008, 12:51 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 33,170, Level: 79
Points: 33,170, Level: 79 Points: 33,170, Level: 79 Points: 33,170, Level: 79
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,161
Thanks: 7
Thanked 188 Times in 186 Posts
Default

Hi there,

One way is to store tree data in a tabe with a self join. E.g.:

Code:
 
Id        Name            ParentId
1         Root            <null>
2         Child 1         1
3         Child 2         1
4         Grand Child 1   3

The ParentId column then refers to the Id column of the same table.

This way, you can always see to what parent an item belongs.

You can learn more about trees in ASP here:

http://www.codeproject.com/KB/asp/treecontrol.aspx
http://www.planet-source-code.com/vb...txtCodeId=6411

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004

Did this post help you? Click the button to show your appreciation!

Last edited by Imar : December 23rd, 2008 at 12:54 PM.
Reply With Quote