index | search | no replies | posting guidelines | help login | register
Index » General » Site & Forum Feedback
search this forum:
:: Treeview ASP v2 :: (4)Post a New Message | Post a Reply
Jul 30 2008, 3:55 PM
 Treeview ASP v2Post a Reply
 dhepburn

View this author's profile Send this author a private message

since: Jul 30, 2008
from: Sydney, Australia

Hi - I love the treeview control for classic asp. I'm using v2.

I have a question which I can't believe I'm the only one who would be requesting this. I want to get more than 3 levels of treeview items. All your examples only go down to 3 levels. How can I get a 4th, 5th, xth level?
Example code please.


Jul 31 2008, 8:38 AM
 Re: Treeview ASP v2Post a Reply
 ghost

View this author's profile Send this author a private message Visit author's homepage

from: Washington, DC

Just keep adding the nodes as shown in the example e.g. to add a 4th node, just add the following code below the erd node:



tv.AddNode("My 4th Node")
tv.Nodes(4).Add(tv.CreateSimpleNode("USD"))
tv.Nodes(4).ChildNodes(0).ImageUrl= "images/dollar.gif"
tv.Nodes(4).ChildNodes(0).Add(tv.CreateNode("$1.00","images/Currency/usd/dollar.jpg","$1.00" ))
tv.Nodes(4).ChildNodes(0).Add(tv.CreateNode("$20.00","images/Currency/usd/new20.jpg","New $20.00 bill" ))
tv.Nodes(4).ChildNodes(0).Add(tv.CreateNode("$100.00","images/Currency/usd/100.jpg","$100.00 bill" ))
  
tv.Nodes(4).Add(tv.CreateSimpleNode("XAF"))
tv.Nodes(4).ChildNodes(1).Add(tv.CreateNode("10, 000 FCFA","images/Currency/xaf/cas2b.jpg","10, 000 FCFA" ))
tv.Nodes(4).ChildNodes(1).Add(tv.CreateNode("1, 000 FCFA","images/Currency/xaf/casf.jpg","1, 000 FCFA" ))
tv.Nodes(4).ChildNodes(1).Add(tv.CreateNode("2, 000 FCFA","images/Currency/xaf/cas4b.jpg","2, 000 FCFA" ))
  
  



-------------------------
Ghost
Jul 31 2008, 3:23 PM
 Re: Treeview ASP v2Post a Reply
 dhepburn

View this author's profile Send this author a private message

since: Jul 30, 2008
from: Sydney, Australia

Sorry - you misunderstood me...

I want to do 4 or more levels under a root. eg.

- Computers
    - Hardware
        - CPU
            - Intel
                - Dual Core
                    o  Intel SPX900
                    o  Intel RRD5000
        + Memory
        + Hard Drives
    + Software
+ Television
+ Home Cinema

This is what I'm trying to achieve. Now someone must have wanted to do this before me so I assume there are some examples out there?

TIA.

Aug 5 2008, 2:31 PM
 Re: Treeview ASP v2Post a Reply
 dhepburn

View this author's profile Send this author a private message

since: Jul 30, 2008
from: Sydney, Australia

I played around with this for ages trying all different combinations of code until finally I hit pay dirt!!!  You just keep adding childnodes(0) to get to lower levels. It seems obvious but I couldn't work it out at the time.
For those that need to know how to do this:-

tv.Nodes.Add(tv.CreateSimpleNode("Computers"))
tv.Nodes(0).Add(tv.CreateSimpleNode("Hardware"))
tv.Nodes(0).ChildNodes(0).Add(tv.CreateSimpleNode("CPU"))
tv.Nodes(0).ChildNodes(0).ChildNodes(0).Add(tv.CreateSimpleNode("Intel"))
tv.Nodes(0).ChildNodes(0).ChildNodes(0).ChildNodes(0).Add(tv.CreateSimpleNode("Dual Core"))
tv.Nodes(0).ChildNodes(0).ChildNodes(0).ChildNodes(0).ChildNodes(0).Add(tv.CreateNode("Intel SPX900","http://www.intel.com","whatever"))
tv.Nodes(0).ChildNodes(0).ChildNodes(0).ChildNodes(0).ChildNodes(0).Add(tv.CreateNode("Intel RRD5000","http://www.intel.com","whatever"))


Pages: (1)   [1]

search this forum: