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 / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Treeview -- default all items to show plus sign?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
llevity@gmail.com - 29 Aug 2005 18:49 GMT
I have a treeview control that's first being populated with a list of
items.  Each item has sub nodes, and sub nodes have sub nodes.  It
takes a while to load the whole thing, so I decided the better approach
was just to load the items for the node that's currently selected.

The problem with this approach is the nodes aren't showing the
plus/minus signs next to them until they are populated.  Thus there's
no cue to the user that more is available under them.

What's the best approach to handling this?  I could hack something
together by going through and adding a dummy node under each parent,
then clearing it before populating it with the real thing, but it seems
like there has gotta be a cleaner way.
Tom Dacon - 29 Aug 2005 21:29 GMT
Your approach of adding a dummy node is the only way I know of to handle
this. I've used it a number of times and it works fine. You just need to do
careful bookkeeping on the placeholder node so that it's never seen. The
general approach of doing "lazy reads" to populate the children is good
practice from a resource and performance standpoint.

If anyone reading this thread has a better way to handle this, I'd like to
know about it myself.

Tom Dacon
Dacon Software Consulting

>I have a treeview control that's first being populated with a list of
> items.  Each item has sub nodes, and sub nodes have sub nodes.  It
[quoted text clipped - 9 lines]
> then clearing it before populating it with the real thing, but it seems
> like there has gotta be a cleaner way.
Richard Lionheart - 30 Aug 2005 01:03 GMT
Just an idea:  Add a dummy node to each node that would have subnodes;  then
trap the click on any node and if a first dubnode exists and is a dummy
node,  delete the dummy and populate it with the real sub-nodes. The new
subnodes should get the same treatment.

HTH,
Richard

P.S.  I accidentily sent this repy as email.  Sorry

>I have a treeview control that's first being populated with a list of
> items.  Each item has sub nodes, and sub nodes have sub nodes.  It
[quoted text clipped - 9 lines]
> then clearing it before populating it with the real thing, but it seems
> like there has gotta be a cleaner way.

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



©2008 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.