|
Rank: Newbie Groups: Member
Joined: 10/28/2007 Posts: 1
|
How can I expand a TreeView to a target node in Page_Load?
I tried looping through the nodes after a call to tree.DataBind(), but the value for tree.Nodes.Count is always 1. It appears to have only one node. The dataSet used for tree.DataSource has Tables[0].Rows.Count = 11, and the treeView control expands properly in response to clicks, so I know the data is correct. I am not able to use "foreach (EO.Web.TreeNode node in tree.Nodes)" to move through the nodes to call ExpandPath() for the target node.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Richard,
Have you tried:
foreach (EO.Web.TreeNode node in tree.Nodes) node.ExpandAll();
tree.Nodes.Count should always indicate the total number of root nodes. So I am not sure what you mean regarding that.
Thanks
|
|
Rank: Member Groups: Member
Joined: 11/3/2007 Posts: 12
|
I don't understand how the code
foreach (EO.Web.TreeNode node in tree.Nodes) node.ExpandAll();
is going to help me expand the tree to a target node. I do not want to expand all of the nodes in the tree, I just want to expand the nodes to display a particular node.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
rsaville wrote:I don't understand how the code
foreach (EO.Web.TreeNode node in tree.Nodes) node.ExpandAll();
is going to help me expand the tree to a target node. I do not want to expand all of the nodes in the tree, I just want to expand the nodes to display a particular node.
Then you just find that node (do not ask me how :p see the document for details) and call ExpandPath on that node. Thanks
|
|