Home > DeveloperSection > Forums > How to force button do a full postback instead of asynchronous postback
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    August-28-2014 1:42 AM

 C#
Ratings:


 1 Reply(s)
 759  View(s)
Rate this:

In an ASP.NET 4.0 web application, I have a user control that is wrapped by an UpdatePanel

<asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional">

    <ContentTemplate>

        <UC:MyCustomCtrl ID="customCtrl" runat="server" />

    </ContentTemplate>

</asp:UpdatePanel>

I have an ASP.NET button  in the user control that makes an asychronous request to the server

 The server then creates an Excel spreadsheet and then places the spreadsheet in the HttpResponse to send back to the client's browser so they can open/save it.

 However, it blows up at this point because the request to the server is asynchronous and apparently you can't put a binary in the HttpResponse during an asynchronous request.

How do I get around this?



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    August-28-2014 2:31 AM

Hi Ankita,

you can add triggers to UpdatePanels that allow full post back. here's an example

<asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateMode="Conditional">

    <ContentTemplate>

        <UC:MyCustomCtrl ID="customCtrl" runat="server" />

    </ContentTemplate>

    <Triggers>

        <asp:PostBackTrigger ControlID="btnID" />

    </Triggers>

</asp:UpdatePanel>


Don't want to miss updates? Please click the below button!

Follow MindStick