Your recursive probe is simple to setup. First, your outer loop will iterate the collection of nodes. For each node you will call a function to either close or open the node. Pass a flag into that function to tell the routine whether to close or open. That way, you only need one routine which will either close or open. For each node in your iteration, you will call this function. The function will iteratively call itself as long as their are nodes which have children. On each call it will examine the close flag and determine what to do.
Another approach is just to iterate thru the top level nodes and close them. Lower levels don't need to be closed since they cannot be viewed. Opening would need recursion/.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Lanny McDonald" <lm*******@hotm ail.com> wrote in message news:OX******** ******@TK2MSFTN GP10.phx.gbl...
I have built a treeview that looks something like:
Root
....FolderLevel 1a
........FolderL evel2a
............Pag e
........FolderL evel2b
............Pag e
............Pag e
....FolderLevel 1b
........FolderL evel2a
............Pag e
............Pag e
........FolderL evel2b
............Pag e
(etc.)
I now need to write two functions--one that recursively opens all nodes and open that recursively closes all nodes. I've tried, but I can't seem to make much progress.
Has anyone done this? If so, would you provide some guidance? Or, if anyone else has any suggestions, they would be appreciated too.
Thanks.