Problems with TreeView within an UpdatePanel

If you have ever tried working with a TreeView within an UpdatePanel, you would notice that it takes forever to render and on postback the whole application seems to be very sluggish.

The reason this occurs is because the javascript that is emitted by the TreeView does not play well with the Update Panel. This is a known issue, but for some reason is not getting a fix.

One way around this is to disable the scripts emitted by the TreeView control and let the UpdatePanel take care of not causing postbacks via the partial page rendering mechanism. This can be done by setting ‘EnableClientScripts=”false”‘ on the TreeView.

6 Comments

amitAugust 26th, 2008 at 7:47 pm

Wow!! That worked like a charm :-)

AleksandarSeptember 1st, 2008 at 5:58 am

Thank you very much for this solution, helped me a lot

stmSeptember 8th, 2008 at 6:10 am

In vs2005 treeview is not supported in updatepanels (but works with lot of bugs). Some of this bugs could be eliminated using EnableClientScripts=false, but in this case the tree will be slow also.

In vs2008 the treeview works fine in updatepanels, and is supported only when EnableClientScripts=true(!)

So the treeview works lightening fast for me in vs2008 (in updatepanel and with turned off viewstate).

What do you think?

Ramesh BhaskarSeptember 8th, 2008 at 8:42 am

@Stm

I haven’t yet tested this out in vs2008, so I’m not sure. But my guess would be that they have fixed the issue.

JonathanJanuary 15th, 2009 at 4:06 am

I have a problem where by the tree view always posts back when inside an update panel. I have set the ChildrenAsTriggers=”false” UpdateMode=”Conditional” and still cannot prevent it from posting back.

Has anyone had this issue?

Ramesh BhaskarJanuary 15th, 2009 at 7:26 am

@Jonathan

The default action of clicking on a node in the treeview is to cause a postback of the page. So although you have disabled the updatepanel from doing a partial postback, it now does a full page postback. I may be wrong of course.

Leave a comment

Your comment