Treeview - Speeding up adding of nodes


I'am facing a "serious"/annoying problem at the moment. We are building an web application with Visual Studio 2008/ASP.NET/VB.NET.
We are using version 3.5 of the .NET framework.

In the web app we have an Treeview-control, that we populate with over 5000 nodes, which are added dynamically during the run time. Doing so takes a long time, and is not really acceptable in terms of user friendliness of the UI.

We just recently started to look into speeding it up a bit, and we found out that [italic]Begin/EndUpdate[/italic]-methods should do just that.

There is just one problem, i cannot find these methods under my Treeview at all.

Has it been removed or am i just looking for wrong things from wrong places, i tried looking for it under my Treeview1, but with no luck so far.


If for some reason i canno't use Beginupdate anymore, is there any other way of speeding it up?

Any help or tips would be greatly appreciated.
Thanks in advance.

- Markus

EDIT: Not sure if this would have gone better under the ASP.NET forums. If so, feel free to move it in there.


  • seancampbellseancampbell Pennsylvania, USA
    Sorry for my delay in response, been really deep in development both at work and home and haven't had the time to sit down and provide solutions over the last month...

    You are right this should have gone in the ASP.Net forum, but I code VB.Net/ASP.Net web apps all of the time so I think I can help a tad.

    The BeginUpdate and EndUpdate are part of the System.Windows.Forms.TreeView but that is only for applications programming. The Control you are using in your ASP.Net page is System.Web.UI.WebControls.TreeView

    Anyway, I am under the impression, from the reading I did today, that the only way to speed up the generation of that TreeView is to NOT put all of those nodes in at once, and instead use the PopulateOnDemand=True property to populate the tree as it is being expanded without a post back. This way only a small amount of things are being populated, and you can generate just the essential information. I learned about how to do that today from the sample code on this MSDN article:

    If that is not an option, and you are just creating a list, I suggest using a ListView, or GridView I think it is in ASP.

    Lastly, if you cannot implement a method like this, but need to load in the 5000 objects anyway, maybe there is something you can do in your code to make it more efficient. If this is the case, post your code up here and I will help you try and "lean" it up.

    Sorry for the delay,
    Sean Campbell - Forum mod
  • Thank you for your reply.

    That explains why i couldn't find it anywhere :)
    I will now try the Populateondemand next, for now i did a program strcture that retreives the data as user browses trough the treeview. PopulateonDemand sounds like it might do just that for me, without the "extra" coding.

    I also started looking at listview today, it is just that TreeView would have been perfect for my purpose, if it just wasn't for it being so slow.

    Anyways, thanks a lot for your help!
    Will let you know if i need any further assistance.

    - Markus
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!