Mittwoch, 7. März 2007

How to prevent treeview control trigger UpdatePanel to update?

Though according to the guide on ASP.NET website treeview is not supported by updatepanel, but sometimes we have to do so. Then how can we enable the user to expand/collapse nodes without triggering the update panel to update?

Trick is to set the "EnableClientScript" property of TreeView control as "True", so that expanding or collapsing any node will be treated by client script but not as post back to server and trigger the update panel to update. Thus even if you set the updatepanel's UpdateModel as "always", it won't update upon such collapsing/expandings.