Sunday, March 11, 2012

Collapsing CollapsiblePanel from Click Event - help needed

I posted something similar before and got a helpful answer. The control inside the panel I wanted to click to close the panel is a button however, and it may not work with another control (or one without an OnClientClick event). Just set the return true to return false if you do not have any other code for the button to execute in the code behind page

<asp:ButtonID="btnClose"runat="server"OnClick="btnGo_Click"Text="Go"OnClientClick="$('btnTogglepanel').click(); return true;"/></td>

This worked for a button outside the panel being the ExpandControlId and the CollapseControlId (btnTogglePanel) and the control inside the panel also being a button. I assume it would work if the ExpandControlId and CollapseControlId has a click even, and the control you want to click inside the panel (btnGo in this case) has an OnClientClick event.

Hope it helps, even if the application is somewhat limited.


Hi Jeremy,

If you search the forums there are a bunch of posts talking about programatically collapsing the CollapsiblePanel from JavaScript. You essentially need to get a reference to the CollapsiblePanelBehavior and call its _toggle method.

Thanks,
Ted
As far as I can tell all of these examples don't work with Beta 1, does anyone have any way to make this work in Beta 1?

The syntax of the sample may be slightly different, but the functionality should still work fine.

No comments:

Post a Comment