Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > help with an ordered list

Reply
Thread Tools

help with an ordered list

 
 
Kevin
Guest
Posts: n/a
 
      06-03-2004
hi everyone. i'm trying to write asp to build an ordered list from a
database table. i'm running into issues with place holding.

here's an example of the data from the table..

id | parentID | file
1 | 0 | index.asp
2 | 1 | sub.asp
3 | 2 | subsub.asp
4 | 1 | sub2.asp


basically the way i have it, the parentID relates to the id of the list
item it should be located under. ie.

index.asp
sub.asp
subsub.asp
sub2.asp

and so on...

any idea how to get this kind of output to create a list like this?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Alan Howard
Guest
Posts: n/a
 
      06-03-2004
Look at coding a recursive routine. Basically pick up the records with no
parent node (ParentID IS NULL) - they're your top level nodes. Iterate
through them and call GetChildNodes (NodeID) where NodeID is the ID of the
node you're currently processing. Process each node (display it) and then
call GetChildNodes (NodeID) for that one, etc. Basically you're trying to do
a depth-first-search. You can use the depth of the recursion to provide help
with the indentation/formatting etc. Be careful though, these routines can
be expensive so optimise your code depending on your requirements.

Alan

"Kevin" <(E-Mail Removed)> wrote in message
news:e2dqu$(E-Mail Removed)...
> hi everyone. i'm trying to write asp to build an ordered list from a
> database table. i'm running into issues with place holding.
>
> here's an example of the data from the table..
>
> id | parentID | file
> 1 | 0 | index.asp
> 2 | 1 | sub.asp
> 3 | 2 | subsub.asp
> 4 | 1 | sub2.asp
>
>
> basically the way i have it, the parentID relates to the id of the list
> item it should be located under. ie.
>
> index.asp
> sub.asp
> subsub.asp
> sub2.asp
>
> and so on...
>
> any idea how to get this kind of output to create a list like this?
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
 
Chris Hohmann
Guest
Posts: n/a
 
      06-04-2004
"Kevin" <(E-Mail Removed)> wrote in message
news:e2dqu$(E-Mail Removed)...
> hi everyone. i'm trying to write asp to build an ordered list from a
> database table. i'm running into issues with place holding.
>
> here's an example of the data from the table..
>
> id | parentID | file
> 1 | 0 | index.asp
> 2 | 1 | sub.asp
> 3 | 2 | subsub.asp
> 4 | 1 | sub2.asp
>
>
> basically the way i have it, the parentID relates to the id of the list
> item it should be located under. ie.
>
> index.asp
> sub.asp
> subsub.asp
> sub2.asp
>
> and so on...
>
> any idea how to get this kind of output to create a list like this?


In addition to Alan's suggestion you may also want to consider using XSL to
transform the link array (edge set) into a hierarchical tree. Here's an
example:

http://groups.google.com/groups?selm...TNGP12.phx.gbl

HTH
-Chris Hohmann


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ordered list inside ordered list DL Javascript 6 11-21-2009 11:43 PM
Ordered list not working in any browser andynagai@verizon.net HTML 3 04-05-2006 08:14 PM
Setting the distance between numbers and text in an ordered list. richard_quick_uk@hotmail.com HTML 3 07-30-2005 02:53 AM
Help Please : - Retrieve object key held in an ordered linked list node Newbie Java 1 04-06-2004 11:12 PM
ordered list (OL) tag with tables Arvind Ganesan HTML 10 09-06-2003 09:47 PM



Advertisments