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

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top