Important alert: (current site time 7/15/2013 11:55:14 PM EDT)
 

winzip icon

TreeView

Email
Submitted on: 12/10/2000 7:54:52 PM
By: SimonLa  
Level: Intermediate
User Rating: By 37 Users
Compatibility: ASP (Active Server Pages), HTML, VbScript (browser/client side)
Views: 68568
(About the author)
 
     This is a very easy way to add a Tree View (like the VB Control) in your html page. With 1 function, add TreeViews with or without checkboxs and links. If you like it, vote for it ! Simon

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/14/2000 10:16:47 AMManas Tungare

Good code; even if it doesn't work with NS, it still degrades gracefully. It doesn't expand/collapse, but atleast allows the user to see all nodes.

And BTW, calculate 12% of the annual eCommerce business in billions, and then tell me it doesn't account for much.
(If this comment was disrespectful, please report it.)

 
12/15/2000 5:47:08 PMBryan Zimmerman

Good code!
Looking for a variation possibly....
Is it possible for a certain page to have one of the trees automatically expanded? Example: If I were to pull up a page that was the "Development Sites" page and I would want just that tree to be expanded, but the others not, is there a dynamic way to do that? Just curious. Gracious for any help.
-bryan
(If this comment was disrespectful, please report it.)

 
12/15/2000 6:10:03 PMEugene

Simon,

This is good code, regardless of which browser you are using. I would hope that I speak for the majority, that you are not liable for restrictions imposed by Netscape.

I like how you test for IE, and if not, the tree is displayed in the expanded format. Great Job!

Eugene
(If this comment was disrespectful, please report it.)

 
12/22/2000 10:52:47 PMSimon La Rochelle

I've edit my code so now you can set the default display (open/close) for each section of the Tree... like Brian ask for.
(If this comment was disrespectful, please report it.)

 
1/30/2001 8:48:19 PMWesley Brand

Great Code! This really helped me out with a project. I'm using the tree's open position for my Netscape users. Thank you so much for putting this out..very user friendly..
(If this comment was disrespectful, please report it.)

 
6/21/2001 4:57:20 PMJoe Dawson

Execellent example. Any ideas about using this code with recursion?
(If this comment was disrespectful, please report it.)

 
7/17/2001 3:15:45 PMmorganrt

Great Code!
I'm embarassed to say that while I can get the example 'TreeView.asp' to display with no problems, when I replaced the links with links of my own to test it, the tree displays differently.
Now the parent 'Exemple1' is displayed, but the parents 'Example2' and 'Development' remain closed until you click on 'Exemple1'.
Why are the two other seperate parents now under the first?
I don't blame Simon's code, just wondering what I did..?
Thanks
(If this comment was disrespectful, please report it.)

 
8/8/2001 2:33:28 AMMatthias

Great Stuff,
I don't have much experience in Web programming so far, but this is the first example on the web (and I found quite a few), which allows you to easily change a bit... Thanks Simon
(If this comment was disrespectful, please report it.)

 
10/5/2001 5:34:46 PMThomas Sturm

Clear and nice! - a lovely Treeview. Wonīt work in Netscape or Opera since they donīt understand the 'block' style. With Opera I expect theyīll fix that shortly. You have to be careful how you place those 'Writehead' and -foots tho, otherwise the
s donīt get closed and the Treeview 'swallows' up all following menus. I have linked it to a database and will post a recursive, non depth limited version soon...when I have translated my comments from german into english, that is :-)
(If this comment was disrespectful, please report it.)

 
11/19/2001 10:43:29 AMDavid

Excellent! Exactly what I was looking for. I have updated the code so that it is datbabase driven and have created a user interface in VB to build the tree a whole lot easier. Will be posting it soon.

There is one little glitch though. I have the menu building in a left frame. When you expand the nodes and go out past the size of the frame, the text wraps instead of automatically showing the scroll bar. Any ideas on how to fix this? Have tried setting 'scrolling' to yes on the frame but this doesn't do the trick.

-David
(If this comment was disrespectful, please report it.)

 
11/19/2001 11:52:57 AMDavid

I fixed the wrapping issue. Found the HTML tag and used that. Had to place the opening tag before the area where the level is checked and the ending tag after the title of the node is written.

-David
(If this comment was disrespectful, please report it.)

 
4/22/2002 8:05:17 PMRavi

Great code.
I am trying to use Scripting.FileSystemObject to build drive,folders,files.
Does anybody having ideas.
(If this comment was disrespectful, please report it.)

 
4/23/2002 6:33:27 AMPhil

This is the easiest code to understand, the easiest to implement and the most versitlile I have seen in years. Well Done! And thank you for sharing this with us all
(If this comment was disrespectful, please report it.)

 
4/25/2002 12:41:32 PMsagar

I am kind of crunch in building a tree control from database tables.

can please send me the sample of this control wich will get tree structure from database?
thanks
Sagar
sagar.yerramsetty@signaltreesolutions.com
(If this comment was disrespectful, please report it.)

 
5/22/2002 10:25:06 AMAlex

Very nice code. Just the example I was looking for.
Thanks a lot
(If this comment was disrespectful, please report it.)

 
5/22/2002 3:03:21 PMNJK

excellent.
(If this comment was disrespectful, please report it.)

 
5/23/2002 1:58:44 PMDan

Excellent idea.Is there a problem with the depth of the levels? I seem to have scripting errors using levels above 5. It might just be my code though. is there a problem with using very very large trees (mine has approx 2500 nodes)?
Any help would be gratefully appreciated.
(If this comment was disrespectful, please report it.)

 
5/30/2002 8:02:33 AMThe Saint

Just Great Piece of Code!!!
I only have some kind of problem when i add Third Level. The expand-collapse is not working after the third level of the Tree. What can i do about that?

Thanks for the nice code
(If this comment was disrespectful, please report it.)

 
5/30/2002 8:22:00 AMThe Saint

I was doing something wrong! Sorry
(If this comment was disrespectful, please report it.)

 
8/27/2002 10:58:25 AMRenso

How can I make it remember the last view if I do a back or return to the page? Thanks.
(If this comment was disrespectful, please report it.)

 
9/11/2002 4:19:31 PM

Does it work under MAC??
thanks
(If this comment was disrespectful, please report it.)

 
10/14/2002 3:37:29 AM

I'm a html- beginner. Can you please explain me how I can integrate your code in my page. I just found your asp- code but I didn't found an exe for a command like treeview Pagefile. Can you help me?

thanks in advance

Marc
(If this comment was disrespectful, please report it.)

 
11/3/2002 8:44:43 PM

Hi.
What's the checkboxes for?
(If this comment was disrespectful, please report it.)

 
12/11/2002 4:19:20 PM

Nice Work. Thanks.
(If this comment was disrespectful, please report it.)

 
12/13/2002 1:33:53 PM

Ravi,

Have you tried using Scripting.FileSystemObject. Could you please share your ideas

Thanks
(If this comment was disrespectful, please report it.)

 
3/27/2003 2:49:10 AMTropical Wire

Thanks a lot man. You saved my 25 man hours of work. Great & keep going.
(If this comment was disrespectful, please report it.)

 
6/28/2003 1:47:09 PM

How do you determine which check boxes are checked for further processing?
Thankx
(If this comment was disrespectful, please report it.)

 
10/22/2003 3:24:16 PM

Great code! Keep up the good work. One of the few codes out here that works nicely with creating dynamic lists.
(If this comment was disrespectful, please report it.)

 
12/9/2003 5:05:56 AM

Hey, i am not able to download the code as i have restrictions. It would be nice if you people provide copy & Paste option.
(If this comment was disrespectful, please report it.)

 
10/1/2004 4:53:00 AMsridevi

hai
i was really satisfied with this code in the static level ,but i have to implement this dynamically (ie) get the records from the sql server and create a tree view structure,can give me a idea
by
sridevi
(If this comment was disrespectful, please report it.)

 
11/12/2004 9:39:34 AM

Top notch code. I am wondering about how to tell which check boxes are "on" and have those selected query the records from the database. Any help would be great. Thanks in advance for your help.
(If this comment was disrespectful, please report it.)

 
1/31/2005 8:59:50 PM

Hi,

Has anyone figured out how to get this to work on Netscape?
(If this comment was disrespectful, please report it.)

 
12/13/2006 7:21:44 AMujjwal

Code is good but when i tried in my code thaking data from database it not woking properly.When I click first option it closes all child which are not the child of this parent(where i have clicked)
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.