Last post Apr 01, 2007 06:48 PM by Russ Helfand
Mar 28, 2007 09:51 AM|Johan_p|LINK
I've been trying to use the CSS Friendly Control Adapters on a site, with a SiteMap as a DataSource for my TreeView Control. This works pretty good, and feels like a definitite improvement over the table based treeview.
However, i have a problem. I want my treeview to be populated based on what node is selected. Initially i want only the top level nodes to be visible, and then when one of them is selected, i want it's children-nodes to become visible on postback, and so on
down through the tree (the parent always staying open while you're navigating in one of the children nodes).
I think i saw an example on this forum that did this earlier, but now i can't find it. I would appreciate some pointers in the right direction or a link to an example on how i could accomplish this.
Apr 01, 2007 06:48 PM|Russ Helfand|LINK
I think you're asking about a couple of somewhat separate things: populate-on-demand (so the tree is filled in only as needed) and expand-to-current page.
There's a really interesting previous posting about expand-to-current page here,
http://forums.asp.net/thread/1452510.aspx. Have you already seen that? If not, you might want to "mine" it for nuggets of goodness.
The adapter already supports a notion of populate-on-demand. Often, folks intend this to be used on a page (with a tree) that posts back to itself. However, I'm pretty sure I coded up the feature so it would work between different pages, too. Try simply
setting the TreeView property called PopulateOnDemand to true. See also this sample that comes with the kit,