CollapsiblePanelExtender set collapsed

Dukebaby picture Dukebaby · Jan 15, 2009 · Viewed 7.3k times · Source

I am using a CollapsiblePanelExtender in the AjaxToolkit 3.5 to show/hide search filter options.

I want the CollapsiblePanelExtender to be expanded when the page first loads, !Page.IsPostBack.

After that I want the CollapsiblePanelExtender to be collapsed because this means they either submitted some filter options or are going to another page in the search results. In either event I want the CollapsiblePanelExtender to be collpased.

Is there a way I can acheive this?

In the code-behind in the button submit handler I've tried adding:

CollapsiblePanelExtenderID.CollapsedSize = 0 CollapsiblePanelExtenderID.Collapsed = true

but this doesn't seem to be working. I also added this to the lvProducts_PagePropertiesChanging handler where the Paging is handled.

Answer

Dukebaby picture Dukebaby · Jan 16, 2009

I figured it out again.

I needed to add this:

    if (!Page.IsPostBack)
    {
        // do something
    }
    else
    {
        cpFilter.Collapsed = true;
        cpFilter.ClientState = "true";
    }

thanks to this link: http://www.dotnetcurry.com/ShowArticle.aspx?ID=230&AspxAutoDetectCookieSupport=1