Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

asp.net 2.0 treeview control - very slow

18 views
Skip to first unread message

Doug Salomon

unread,
Feb 1, 2006, 2:11:36 PM2/1/06
to
I've been playing around with the treeview control, and I'm finding that it
displays extremely slowly in Internet Explorer. I've been checking my work in
IE 6 and 7 beta2 and in Firefox 1.5. Firefox is fast enough, but IE is
unreasonably slow.

My page builds the tree in code. It adds four top level items. Each of those
gets 10 children, and each of those children gets 20 children. (So there are
844 individual nodes).

The code itself runs very quickly. It is just the rendering of the treeview
to the browser that seems to be the problem.

I've done a few tests whch, pretty much, convince me that it is not the code
that I use to build the tree.

If I remove the treeview from the page's controls collection, the page loads
very quickly, but, of course, nothing ever gets displayed.

If I replace the treeview with a menu object, I can use almost identical
code to build the menu, which displays very quickly.

Does anyone have any suggestions?

Doug Salomon

unread,
Feb 1, 2006, 2:45:57 PM2/1/06
to
For what it's worth, I've just made some changes to my code so that the child
(and grandchild) nodes are populated on demand.

This did not really help IE, and if anything, it slowed down Firefox (but
that might just be my imagination).

Doug Salomon

unread,
Feb 1, 2006, 3:05:30 PM2/1/06
to
More...

I've made some more changes, which are a bit more hopeful.

In the post above, where I said that I was using populateondemand, I was
probably doing it in a silly way (but in my defence, I was just following the
steps outlined in some tutorial).

Basically, I had three functions : populateTopLevelNodes,
populateChildNodes, populateGrandChildNodes.

On load, I ran populateTopLevelNodes. Then in the TreeView1_TreeNodePopulate
event handler, I populated everything else. So, I would check the type of
node, and populate it accordingly (using populateChildNodes or
populateGrandChildNodes).

As I mentioned, this was not particularly useful.

I changed things so that the populateChildNodes and populateGrandChildNodes
now get called from the TreeView1_SelectedNodeChanged event handler. This is
a bit faster, although I am getting some errors when I click on the child
nodes.

My problem with this is that it complicates my code and just seems
unnecessary.

I'd still like to know if someone has a better solution.

Thanks,
Doug

Doug Salomon

unread,
Feb 28, 2006, 8:54:49 AM2/28/06
to

I'm having truoble believing this, but it looks like you're right!

If I plop the treeview into a table, IE slows down. If I remove it from the
table, IE speeds up.

Its still not as fast as Firefox, but I think I can make this work well
enough now.

thanks,
Doug

"WayneB" wrote:

> Hi
>
> I've been having the same problem. IE very slow, Opera and Firefox pretty
> quick. I don't think it's your code.
>
> I was placing my treeview in a table. If I remove the table and replace with
> a <div> it works just as quickly as Opera and Firefox. Let me know if this
> works for you.
>
> Cheers
>
> Wayne

Doug Salomon

unread,
Mar 6, 2006, 9:41:32 AM3/6/06
to
Oh well, that sense of euphoria didn't last.

It actually looks like the tree isstill as slow as ever, only when it is not
contained within a table we actually get the pleasure of watching it get
built. (When it is within a table, that outer table does not get rendered
until the contents - the treeview itself - are rendered, s it seems slower.)

This would actually be ok, except that mousing over the treeview while it is
being built causes javascript errors. (Once again, this is with IE only.)

I've tried to disable the treeview until it is fully built, but that does
not seem to work.

Anyone have any ideas here?

Doug

Wilkinson@discussions.microsoft.com Mike Wilkinson

unread,
Mar 7, 2006, 6:42:53 AM3/7/06
to
Hi Doug

I wish I could offer some help, but I'm experiencing the exact same problem
as yourself. If I display the data that builds the tree in a
'Response.Write' way, the data is displayed in less than a second. Build a
treeview with it, and it takes over 30 seconds! We're trying to convert a
desktop system to a web app, and it seems that it just can't be done if
you're dealing with too much data. Seems a shame because I thought that was
the whole point!

If I uncover any ground breaking discoveries, I'll let you know, but I've
now given up with it. Looks like desktop power is here to stay!

Regards,
Mike

Doug Salomon

unread,
Mar 7, 2006, 8:18:28 AM3/7/06
to
Hi Mike,

Thanks for sharing the pain. :)

Doug

monahan7_7

unread,
Dec 21, 2006, 9:08:01 AM12/21/06
to
I had the same problem with the ASP.NET 2.0 menu control. Very fast in
firefox - unacceptable in IE. I posted here - and never got a fix. Turns out
the problem was the number of levels the menu went to. Three levels work
fine, but four or more killed everything. I had to completely rewrite
everything I had done - using 8 different XML sitemaps instead of one - and
choosing which sitemap to load based on the users login . Had to completely
rework my SQL DB tables that are used to build my sitemaps. Ugh!!
0 new messages