I am working on what I call the "TreeJAX" control. It a tree that is bound to a hierarchical collection of objects. The root node is built in code on the control's load method. Then, whenever a node is clicked, I use ASP.NET AJAX JSON asynchronous web services to dynamically build the children all from client script.
Basically, I have something like this:
The table was infinitely looping! Changing the name of my iterator in the first method from n to, say, m made it work! The problem with this code, like so many of my ex-girlfriends, is closure. Closures are functions that "inherit" their environment (ie, in-scope variables) in which they are declared.