If the total amount of data in your treeview is relatively small (<500
items) then you a probably better off loading all the data into a dataset
and sending it across the wire upfront - this will minimize the amount of
network roundtrips which will probably be the limiting factor in this case.
If you have a very deep tree with many items then you can improve
performance by only loading branches of the tree when the user expands them.
To do this you add a dummy node to each node which may have children and
handle the NodeExpand event to dynamically remove the dummy node and add the
real child nodes. This will mean the SQL queries (and network roundtrips)
are only done when you really need them (not all upfront). This still won't
help you if a node of the tree can have a large number of children - as you
will have to load all the children of a node when the user expands it. If
the node has 1000 children this may still be pretty slow.
If you are willing to consider a commercial solution then our VirtualTree
control can help solve these issues. It only loads the actual data required
for the currently displayed nodes. As the user scrolls through the tree or
expands items the additional data required is automatically loaded. I have
used this coupled with a data paging mechanism that retrieves pages of
objects from the server to very effectively balance minimizing network
roundtrips and amount data loaded. You can download a fully functional
trial version at:
http://www.infralution.com/products.html Regards
Grant Frisken
Infralution
Reply
[quoted text, click to view] "Garrett" <anonymous@discussions.microsoft.com> wrote in message
news:145501c4e238$0a4c6040$a501280a@phx.gbl...
> Does anyone have any working TreeView code that loads
> nodes dynamically. I have a ton of info to move across
> the wire and can't seem to find any good examples.
> Microsoft's example only works with two levels.
>
> Thanks
begin 666 r.gif
M1TE&.#EA"P`+`)$#```+U+#Q__^_X/___R'Y! $```,`+ `````+``L```(7
9G(\CD2C F@)0/FHI3I?&TV55\WR<F10`.P``
`
end