How do I force full post-back from a button within an UpdatePanel?
Another possible reason is that if the page has ClientIDMode="static" , then controls that you expect to refresh just the UpdatePanel will refresh the whole page. To fix the problem, you just need to set ClientIDMode="AutoID" on the control(s) which should trigger the UpdatePanel post back.
The UpdatePanel control contains a Button control that refreshes the content inside the panel when you click it. By default, the ChildrenAsTriggers property is true. Therefore, the Button control acts as an asynchronous postback control.
Description. <asp:AsyncPostBackTrigger> Specifies a control and event that will cause a partial page update for the UpdatePanel that contains this trigger reference. <asp:PostBackTrigger> Specifies a control and event that will cause a full page update (a full page refresh).
Introduction. UpdatePanel controls are a central part of AJAX functionality in ASP.NET. They are used with the ScriptManager control to enable partial-page rendering. Partial-page rendering reduces the need for synchronous postbacks and complete page updates when only part of the page has to be updated.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With