By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Collapse sibling nodes in 2.0 Treeview

P: n/a
Howdy folks. Would anyone care to suggest a way to have sibling nodes
(at the same level) collapse when a node is expanded in an asp.net 2.0
treeview control? What I mean is that I want only one subtree to be
open at a time. Can the treeview control do this by itself or is some
fiddeling required?

Regards,
Lantz

Feb 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hello Christopher,

My experience with the Treeview would say that you need to manage the state
of the nodes yourself and that Treeview.FindNode() is your friend:

// Function to collapse all the nodes of a treeview control but the given
parameter

protected void ExpandNode(string expandThisNode)
{
foreach (TreeNode tn in myTreevie.Nodes)
{
tn.Collapse();
}
TreeNode tnExpandThisNode = tvPhoto.FindNode((string)expandThisNode);
tnExpandThisNode.Expand();
}

--
brians
http://www.limbertech.com
"ch***************@gmail.com" wrote:
Howdy folks. Would anyone care to suggest a way to have sibling nodes
(at the same level) collapse when a node is expanded in an asp.net 2.0
treeview control? What I mean is that I want only one subtree to be
open at a time. Can the treeview control do this by itself or is some
fiddeling required?

Regards,
Lantz

Feb 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.