Search code examples
asp.netajaxcontroltoolkitcollapsiblepanelextender

ajaxToolkit:CollapsiblePanelExtender doesn't maintain expand/collapse state on AJAX UpdatePanel refresh


I have a ajaxToolkit:CollapsiblePanelExtender along with two asp:UpdatePanels it controls (one panel expands the other panel when clicked).

Works great until I do an AJAX update from a Timer that kicks off. The page updates...and the CollapsiblePanelExtender collapses :-P

Anyone know how to get this control to maintain the state of the panel it's expanding?


Solution

  • I remember running into this exact problem.

    CollapsiblePanelExtender has a property, ClientState, that doesn't seem to get tracked and maintained in ViewState.

    You should be able to manually track and maintain the value in a HiddenField (or ViewState or Session, if you like) and restore the CPE.ClientState to that value upon the AJAX update.

    UPDATE
    Found a resource that suggests that you simply need to set both Collapsed and ClientState properties. http://weblogs.asp.net/ashicmahtab/archive/2008/11/21/act-collapsiblepanelextender-how-to-collapse-expand-programmatically.aspx