Welcome Guest Search | Active Topics | Sign In | Register

Expand TreeView to target node Options
Richard
Posted: Sunday, October 28, 2007 5:26:24 PM
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
eo_support
Posted: Sunday, October 28, 2007 5:29:38 PM
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
rsaville
Posted: Tuesday, November 20, 2007 3:02:27 PM
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.
eo_support
Posted: Tuesday, November 20, 2007 4:31:25 PM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.