The CollapsiblePanelExtender is a cool way to convert simple panels to collapsible ones. It usually has a target panel, a control which can make it collapse, another (or the same) control to make it expand etc. Clicking the said controls will trigger the collapse/open behaviour.
Client side manipulation is pretty simple and can be found in the tutorials section in www.asp.net/learn - we just need to call these methods:
To open: $find('cpe1')._doOpen();
To close: $find('cpe1')._doClose();
The $find tracks down the behaviour object and calls the _doOpen or _doClose methods.
This is surprisingly slightly trickier. You'd think that just calling
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), DateTime.Now.ToString(), "$find('cpe1')._doOpen();", true);
would work. It doesn't. Any attempt to call $find('cpe1') results in a null. This is likely because of the fact that behaviours are added at the end and our script gets registered before the behaviour is available. The actual way to do it is actually quite simple (once you know how):
To open: cpe1.Collapsed = true; cpe1.ClientState = "true";
To close: cpe1.Collapsed = false; cpe1.ClientState = "false";
Hope that helps.