This is a migrated thread and some comments may be shown as answers.

TreeView collapses on submit

1 Answer 51 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 12 Oct 2011, 12:00 AM

I have several RadTreeViews, some whose nodes are static and some whose nodes use TreeNodeExpandNode.WebService to load the nodes on demand. The number of TreeViews is dynamic, and thus I need to build them from scratch in codebehind (RadTreeview tree1 = new RadTreeview()).

My page has a Submit button which causes a postback. Since my trees are dynamic, I am forced to rebuild them for each postback.

The problem is with the node state. On the first postback and subsequent tree rebuilds, the tree is displayed as the user left it (expanded nodes, checked nodes, and all). But if the user submits again, causing a second postback, the tree is collapsed and, if the nodes selected are from a subnode of one using the web service, those checked are not remembered.

Is there something I can do to (a) prevent the trees from collapsing and (b) rememeber all nodes that were checked prior to the postback, no matter how many subsequent postbacks occur?



1 Answer, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 12 Oct 2011, 06:55 PM
I figured it out.  It's because I was calling tree1.Nodes.Clear() during the postback, which I was doing to fix a seperate issue.  Thanks.
Tags
TreeView
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Share this question
or