PDA

Click to See Complete Forum and Search --> : create tree structure in asp


kevincarvin
Jan 30th, 2001, 05:20 PM
How can I create a tree structure in asp useing a recursive function.
Ex. Database with three fields: ID, Parent_Id, Name

1 0 NFL
2 0 NBA
3 1 AFC
4 1 NFC
5 3 East
6 3 West
7 4 East
8 4 West
9 2 East
10 2 West

Output on Page in links.

NFL
- AFC
- East
- West
- NFC
- East
- West
NBA
- East
- West

The code should be dynamic and allow for any number of parent/child levels.

Thanks,
Kevin

tonyenkiducx
Feb 1st, 2001, 08:39 AM
Unfortunately making an infinate tree structure in ASP is not as easy as it might sound, I had to do it once with a dhtml dropdown menu system. The only way to do it, is to define a function that draws a sub menu, then make a call on it, have the function itself check if it needs to draw a sub function, then call itself again. But bewarned, vb and asp do not thread well, and I dunno what affect it might have on server performance(I decided on a fixed 99branch length tree for my dhtml solution)

da_silvy
Feb 2nd, 2001, 07:23 AM
i have made code for a treeview in jscript.
i don't know where it is but i will try to find it and make a new one for asp

does it have to run off a database?

kevincarvin
Feb 2nd, 2001, 01:52 PM
Thanks for replying to my query about an asp tree.
Yes, it will be using a database. The result is to create
a left navigation of links with tree structure hierarchy.

equuelus
Feb 4th, 2001, 08:18 PM
I think this will be useful for you : CodeCharge software. It has an example of how to make trees using ASP, ASP Templates. It's really cool. Check it out.

http://www.codecharge.com

There is a trial download for it. Good luck.