Wednesday, March 28, 2012

Treeview ExpandAll problem in beta 1, 2 with EnableClientScript="true"

I have a treeview problem inside an update panel since the first beta. In the last ctp no problem at all.

I have a treeview in the updatepanel with EnableClientScript="true". I have two button in the same update panel, that calls ExpandAll, and CollapseAll in server side click events. That works as expected: the updatepanel refresh the treeview with all node collapsed/expanded. However after then when I expand one node (that not cause a postback yet), and select a node (which now cause a postback), the nodes collapsed/expanded randomly after the updatepanel refresh.

It seems that the server side ExpandAll/CollapseAll could be out of the sync with the client side node expanding/collapsing.

It seems to me when EnableClientScript="true" for a treeview, the tree maintain the expanded/collapsed node in hidden fields, and that hidden field could be out of the sync after a server side ExpandAll/CollapseAll.

?

I write a small javascript function which collapse or expand all node on the cilent side for the treeview. Even the nodes collapsed state is persisted during postbacks/partial postbacks.

The bug still exist, but I will not use the server side ExpandAll in the future...

(just found by the docs that the treeview is not supported in the updatepanel officially, but many of us using it without main problems)

No comments:

Post a Comment