Export excel with npoi, the foreground page is still ASPX, and then report the error of “failed to receive message from the server”.
Error about “the server cannot set the content type after sending the HTTP header”:
1. Myxls is used to export components
2. The page adopts ASPX
3. The main contents of the page include:
<form runat="server"> <asp:ScriptManager ID="Scriptmanager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> < ASP: button runat = "server" id = "btnexport" text = "export to excel" cssclass = "btn_common" onclick = "btnexport_click" / > </ContentTemplate> </asp:UpdatePanel> </form>
If it cannot be exported, the error shown in the title will be reported.
The solution is to add the ability of “global refresh” to btnexport
Add the following code between to solve the problem
<Triggers> <% -- < ASP: asyncpostbacktrigger controlid = "" / > -- > <% -- local refresh value refresh UpdatePanel internal --% > < ASP: postbacktrigger controlid = "btnexport" / > <% -- refresh all -- > <% -- on July 1, 2016, solve the error of "the server cannot set the content type after sending the HTTP header" when clicking the Export button --% > </Triggers>
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message. Thank you for your support for developeppaer.