It collapses because the html is replaced with what comes from the server after the postback, therefore, the CollapsiblePanelExtender
returns to the default state.
If you can use UpdatePanels, consider the following:
Put the CollapsiblePanelExtender
inside an UpdatePanel
. Set the UpdatePanel
UpdateMode="Conditional"
and ChildrenAsTriggers="false"
.
The client state of the html inside that updatepanel will be maintained after the Postback because the panel will not update.
If you ever need it to update, you could update it manually by calling updatePanel.Update()
.