Search code examples
javascriptasp.netajaxcontroltoolkit

Collapsible Panel Get State


I am trying to check the state of a panel with collapsible panel extender.

I want to know on client side know whether it is expanded or collapsed.

Pretty much as simple as that. Anyone got any ideas?


Solution

  • function SomethingThatNeedsToKnowTheStateOfThePanel(){
        var extender = $find("<%= thePanelExtender.ClientID %>");
        if(extender.get_Collapsed()){
            // panel collapsed
        } else {
            // panel not collapsed
        }
    }
    

    Assuming that thePanelExtender is the extender control. You can also change the collapsed state using set_Collapsed(true|false)

    See http://www.dotnetcurry.com/ShowArticle.aspx?ID=230