Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

Collapse sibling nodes in 2.0 Treeview

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
christoffer.lantz@gmail.com - 15 Feb 2006 22:19 GMT
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
brians[MCSD] - 16 Feb 2006 00:15 GMT
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();
}

Signature

brians
http://www.limbertech.com

> 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
[quoted text clipped - 4 lines]
> Regards,
> Lantz

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.