How do I force full post-back from a button within an UpdatePanel? How do I force full post-back from a button within an UpdatePanel? asp.net asp.net

How do I force full post-back from a button within an UpdatePanel?


You can use the Triggers property of the UpdatePanel to register actions that trigger a full postback.

Add a PostBackTrigger object to that property, containig the ControlID of the control which needs to trigger a full postback.

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">    <ContentTemplate>        ...    </ContentTemplate>    <Triggers>        <asp:PostBackTrigger ControlID="myFullPostBackControlID" />    </Triggers></asp:UpdatePanel>


Just adding this because nobody else has. It is possible to do this in code-behind in one line of code without any of the above methods. Just put this in page_load:

Visual Basic

ScriptManager.GetCurrent(Me).RegisterPostBackControl(myButtonID)

C#

ScriptManager.GetCurrent(this).RegisterPostBackControl(myButtonID);


From here:

Use the PostBackTrigger control to enable controls inside an UpdatePanel to cause a postback instead of performing an asynchronous postback.

 <Triggers>    <asp:PostBackTrigger ControlID="controlID" /> </Triggers>