PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average.

Missing the 'Expandable' TreeNode property

 
 
=?Utf-8?B?Q2V6YXI=?=
Guest
Posts: n/a
 
      11th Mar 2005
The MSDN has an article titled:
"HOW TO: Dynamically Add Nodes to a TreeView WebBrowser Control by Using
Visual C# .NET".
The article exploits a property of the TreeNode control called 'Expandable'.
However, the property is available only for the Web Controls, and to my
surprise I couldn't find it among the TreeNode Windows Forms properties.
This Expandable property is crucial if you want to develop a smart, dynamic
tree view which doesn't load all the data at once, but does it automatically
as the user requests to expand the node.
This is especially important if you want to bind the tree view to a database
which can contain thousands of rows and you don't want to load all the nodes
if the user doesn't even request it.
Without the Expandable property the node doesn't have the ability to expand
if you don't feed the sub-nodes during the tree creation. In other words the
node doesn't have the 'plus' box to trigger the 'Expand' request. If the
subnodes are supposed to be provided only on the expand request, then you are
stuck.
Is there any workaround for this problem?
Thanks
Cezar


 
Reply With Quote
 
 
 
 
Tobin Harris
Guest
Posts: n/a
 
      13th Mar 2005
"Cezar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The MSDN has an article titled:
> Without the Expandable property the node doesn't have the ability to
> expand
> if you don't feed the sub-nodes during the tree creation. In other words
> the
> node doesn't have the 'plus' box to trigger the 'Expand' request. If the
> subnodes are supposed to be provided only on the expand request, then you
> are
> stuck.
> Is there any workaround for this problem?
> Thanks
> Cezar


I have a work around that I've used in several programs (for example, see
the lazy-loading database tree view in SqlBuddy (sqlbuddy.sourceforge.net).

The work around is to add a dummy node to each parent node that you want to
lazy load. This forces the "+" to appear on these parent nodes. Then, in the
afterexpand event, first see if there is a "dummy" node under the parent. If
so then delete it (you don't want the user to see it). Then do your lazy
loading to add the real child nodes. A nice side-effect is that, if there
aren't any child nodes to lazy load, the "+" will dissappear (since the
dummy has been removed).

Hope this helps

Tobin


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2V6YXI=?=
Guest
Posts: n/a
 
      15th Mar 2005
Thank you very much for your answer.
This is exactly what I did. The exception is that if there are no child
nodes I don't remove the dummy and simply let it show. The dummy has no text,
just a broken line ending in empty space making an impression of nothing to
chose from.

"Tobin Harris" wrote:

> "Cezar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > The MSDN has an article titled:
> > Without the Expandable property the node doesn't have the ability to
> > expand
> > if you don't feed the sub-nodes during the tree creation. In other words
> > the
> > node doesn't have the 'plus' box to trigger the 'Expand' request. If the
> > subnodes are supposed to be provided only on the expand request, then you
> > are
> > stuck.
> > Is there any workaround for this problem?
> > Thanks
> > Cezar

>
> I have a work around that I've used in several programs (for example, see
> the lazy-loading database tree view in SqlBuddy (sqlbuddy.sourceforge.net).
>
> The work around is to add a dummy node to each parent node that you want to
> lazy load. This forces the "+" to appear on these parent nodes. Then, in the
> afterexpand event, first see if there is a "dummy" node under the parent. If
> so then delete it (you don't want the user to see it). Then do your lazy
> loading to add the real child nodes. A nice side-effect is that, if there
> aren't any child nodes to lazy load, the "+" will dissappear (since the
> dummy has been removed).
>
> Hope this helps
>
> Tobin
>
>
>

 
Reply With Quote
 
New Member
Join Date: Nov 2011
Posts: 2
 
      12th Nov 2011
hope this help

http://aspnetvisual.blogspot.com/201...-nodes-to.html
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is equivalent of vb.net treenode.nextnode property in asp.net webcontrols.treenode tanya foster Microsoft ASP .NET 3 18th May 2006 06:58 PM
Get TreeNode.Parent property when using 2.0 TreeViewl? clintonG Microsoft Dot NET 0 20th May 2005 03:17 AM
TreeNode color property error JBeerhalter@gmail.com Microsoft C# .NET 0 4th Jan 2005 12:35 AM
Stack overflow with TreeNode property The Kiddie Microsoft C# .NET 2 25th Oct 2004 09:16 PM
Getting the Tag Property for each child treenode Charles Microsoft Dot NET Framework Forms 1 17th Nov 2003 04:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:41 AM.