Wednesday, March 28, 2012

Extender not collapsing when button clicked - code posted. Using Fridays build 11/10

When I click on the button - the extender should collapse. It collapses when I click on the header of pnlHeader. But not when I click on the button.
This code worked in beta 1. If I get rid of the updatepanel it works.

<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<atlas:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" RenderMode="inline">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server" TargetControlID="pnlAddAccounts"
ExpandControlID="pnlHeader" CollapseControlID="pnlHeader" Collapsed="False" ImageControlID="Image2"
SuppressPostBack="true">
</ajaxToolkit:CollapsiblePanelExtender>
<asp:Panel ID="pnlHeader" runat="server" Visible=true style="cursor: pointer;" CssClass="collapsePanelHeader">
<table border=0 cellpadding=3 cellspacing=0 width="100%" height="20px">
<tr><td align=center valign=middle width="97%">Additional Accounts</td>
</tr></table>
</asp:Panel>

<asp:Panel ID="pnlAddAccounts" runat="server" Visible="true" style="overflow:hidden;">
asdfaslkdjflajsfdlj
</asp:Panel>
</ContentTemplate>
</atlas:UpdatePanel>
</div
</form>

protected void Button1_Click(object sender, EventArgs e)
{
cpe.Collapsed = true;
cpe.ClientState = "true";
}

I've just createdwork item 5688, "Switch to ScriptManager.RegisterHiddenField for ClientState backing store", to track this problem. Here's the description from the work item:

The investigation ofhttp://forums.asp.net/thread/1462069.aspx led to the realization that an ASP.NET AJAX behavior change between Beta1 and Beta2 such that Extender controls now have their GetScriptDescriptors methods called during Render (instead of PreRender) can cause breaking changes for users who update ClientState during async postbacks. Specifically, the updated ClientState value won't necessarilly be included in the updated UpdatePanel content that's sent back to the browser. The fix for this is to use ScriptManager.RegisterHiddenField to create the relevant backing store. It's supposed to be fairly straightforward to do.

Sorry for the trouble, we'll get this fixed for our next release!


I don't have this property ScriptManager.RegisterHiddenField in my scriptmanager...

When the next release is supposed to go out?

Thanks


With luck, sometime soon-ish. :)

No comments:

Post a Comment