asp:treeview reset content and expanddepth

R

rockdale

HI,

I need to re populate my treeview control based on user's selection.
Seems like there is no treeview.clear/ reset method. So I remove the
rootnode from my treeview as following

TreeNode n = tvSchedule.FindNode("-1");
if(n!=null){
myTreeView.Nodes.Remove(n);
}

then I populate my treeview

and finally I add in my root node, set the expandDepth


root.Selected = true;
myTreeView.Nodes.Add(root);

myTreeView.ExpandDepth = 2;


The expandDepth works fine the first time the page loaded. But when
user click the linkbutton which re populate the treeview, the
expandDepth always on the root level.

Has anyone met this problem before?

thanks
-rockdale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top