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.
Wow!! That worked like a charm
Thank you very much for this solution, helped me a lot
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?
@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.
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?
@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.