When I use a PopulateOnDemand TreeView inside an UpdatePanel - when I click on the root node to populate its immediate children, it expands with the child nodes displayed. If I then click on any of the child nodes, the root node collapses. This does not happen if not in an UpdatePanel.
Also, if I click on the root node again and then click on an immediate child to populate its children, it has the same behavior. After the root node automatically collapses, if I click on the root node again, all child nodes that were expanded will still be expanded.
Does anyone know how I can get the root node to not automatically collapse when I click on any of its descendent nodes?
The TreeView isn't supported inside an UpdatePanel, see the last bullet point on this blog and follow the UpdatePanel doc link:http://blogs.visoftinc.com/archive/2007/09/23/asp.net-ajax--updatepanel-not-working--common-problems.aspx
PopulateOnDemand PopulateNodesFromClient actually uses client script as it is.
-Damien
Thanks for the response. When you say that it uses client script, what does that mean? PopulateOnDemand seems to cause full page refreshes - even when I use EnableClientScript and PopulateNodesFromClient...
That's what PopulateNodesFromClient does:http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.populatenodesfromclient.aspx.
The example states:"The following code example demonstrates how to use thePopulateNodesFromClient property to enable client-side population of the nodes in theTreeView control. Notice that when client-side node population is enabled, nodes are populated dynamically on the client, without the need to post back to the server."
-Damien
Thanks. My point was that it still caused a full page refresh. If it was happening on the client (using Ajax), then I wouldn't see a full page refresh. It turns out that I had to take out my TreeNodeExpanded and TreeNodeCollapsed event handlers to get rid of the full page refresh. After doing that, though, child nodes (that definitely have a parent node) have their Parent property set to null.
I am making headway though...thanks for your help.
You may want to check out this:http://steveorr.net/articles/Ajax.aspx
-Damien
Thanks. Good article. But it still does not explain why the Parent property is null on a child node. Again, this only happens with EnableClientScript, PopulateNodesFromClient and without TreeNodeExpanded and TreeNodeCollapsed event handlers. I need the Parent node for context so I can populate nodes more than 2 deep.
No comments:
Post a Comment