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

populating a treeview with a lot of records

P: n/a
I have a treeview control on a windows form that I want to populate in the form's load event. The problem is that the datatable I am using to populate it contains >20,000 records, and it takes > 1 min to load the form. How can I populate it partially during load and then complete it when the user needs the complete set (i.e. when the user scrolls down)?
Nov 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"Patrick McGuire" <an*******@discussions.microsoft.com> schrieb
I have a treeview control on a windows form that I want to populate
in the form's load event. The problem is that the datatable I am
using to populate it contains >20,000 records, and it takes > 1 min
to load the form. How can I populate it partially during load and
then complete it when the user needs the complete set (i.e. when the
user scrolls down)?


Only populate the first and second level. As soon as the user expands a node
from the first level, load the sub nodes of all sub nodes of the expanded
node.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
A good idea, and I'm already doing that. The situation to which I'm referring, though, is one where there are > 20,000 records on the first tier

I've thought about using, say, "TOP 100", in my SelectCommand's CommandText, but how do I smoothly continue the populating when the user attempts to view more nodes by scrolling down?
Nov 20 '05 #3

P: n/a


----- Armin Zingler wrote: ----

"Only populate the first and second level. As soon as the user expands a nod
from the first level, load the sub nodes of all sub nodes of the expande
node.

A good idea, and I'm already doing that. The situation to which I'm referring, though, is one where there are > 20,000 records on the first tier

I've thought about using, say, "TOP 100", in my SelectCommand's CommandText, but how do I smoothly continue the populating when the user attempts to view more nodes by scrolling down?

Nov 20 '05 #4

P: n/a
"Patrick McGuire" <an*******@discussions.microsoft.com> schrieb


----- Armin Zingler wrote: -----

"Only populate the first and second level. As soon as the user
expands a node from the first level, load the sub nodes of all sub
nodes of the expanded
node."

A good idea, and I'm already doing that. The situation to which I'm
referring, though, is one where there are > 20,000 records on the
first tier.

I've thought about using, say, "TOP 100", in my SelectCommand's
CommandText, but how do I smoothly continue the populating when the
user attempts to view more nodes by scrolling down?

I don't know how to populate it when scrolling down, sorry. I'd say that
20,000 records is much more than a user can handle. Maybe the code to fill
the control can be optimized?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

P: n/a
Group the records in some fashion *above* the top tier, perhaps
alphabetically, or by date (grouping by day, week, or month), or by using
some other suitable categorization. Your goal is to find a way reduce the
number of items in the first tier. I agree with Armin that 20,000 records is
too many to be useful, and as you can see, returning that many records
causes UI problems.

At the same time, I suggest you give users better search/filter options, so
they don't get 20,000 records back.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:On**************@TK2MSFTNGP11.phx.gbl...
"Patrick McGuire" <an*******@discussions.microsoft.com> schrieb


----- Armin Zingler wrote: -----

"Only populate the first and second level. As soon as the user
expands a node from the first level, load the sub nodes of all sub
nodes of the expanded
node."

A good idea, and I'm already doing that. The situation to which I'm
referring, though, is one where there are > 20,000 records on the
first tier.

I've thought about using, say, "TOP 100", in my SelectCommand's
CommandText, but how do I smoothly continue the populating when the
user attempts to view more nodes by scrolling down?

I don't know how to populate it when scrolling down, sorry. I'd say that
20,000 records is much more than a user can handle. Maybe the code to fill
the control can be optimized?
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

P: n/a
how about using a hierarchical grid UI instead of a treeview.
Nov 20 '05 #7

P: n/a
>How can I populate it partially during load and then complete it when the
user needs the complete set (i.e. when the user scrolls down)?

Are you serious? Just read 50 records from the DB, and display the form.
Read the rest (and show an hourglass) when the user does something.
Nov 20 '05 #8

P: n/a
Patrick,
Would you consider an alternative to MS TreeView ?

Our TList control

a) Is much faster even if loading all records
directly into memory
( 20,000 records in under 1 SECOND ! )

b) also has a Virtual Load mechanism that triggers
an event where you can supply the data only as
needed.
Basically you tell TList how many nodes you've
got and then fill in the data when the
user scrolls, expands a branch, etc.

For such a small data set ( just 20,000 records )
I would suggest loading directly into memory.
That way you can use TList's other features for
Printing, File I/O, Search, Sort, etc.
Usually we recommend the Virtual loading only
for really large data sets - 50,000 or more
( TList can handle over a million items )
Drop me a note if this sounds interesting to you
I'd be happy to send additional information and
answer any questions you may have about TList.

* * Please include a copy of this note with your reply

Jeff Bennett
Je**@Bennet-Tec.Com

Bennet-Tec Information Systems, Inc
50 Jericho Tpk, Jericho, NY 11753
Phone 516 997 5596, Fax - 5597
WWW.Bennet-Tec.Com

RELIABLE Component Software
and Software Development Services
* TList/Pro * ALLText HT/Pro * MetaDraw *

====================== ======================
-----Original Message----- From "Patrick McGuire"
<an*******@discussions.microsoft.com>
I have a treeview control on a windows form that
I want to populate in the form's load event.
The problem is that the datatable I am using
to populate it contains >20,000 records,
and it takes > 1 min to load the form.
How can I populate it partially during load
and then complete it when the user needs the
complete set (i.e. when the user scrolls down)?


Nov 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.