Ajax gives great advantages in terms of navigability, interactivity and user experience to your web application.
One factor that is often overlooked is the reduction of traffic generated from the pages, since only a small part of the page is sent from server to browser. In practice avoids the need to send every time an entire document, but only a part.
Response.ContentType = "application / vnd.ms-excel"
Response.AddHeader ("Content-Disposition", "attachment; filename = Report.xls ") response.write
...
Response.End
We are sending to the browser something inappropriate to the context.
When you press the button the broser return an error message quite clear:
Sys.WebForms.PageRequestManagerParserErrorException: The Message Received from the server Could not be parsed. Common Causes for this error are When the response is modified by calls to response.write (), response filters, HttpModules,
or server trace is enabled.
Fortunately around this problem is quite simple:
trigger of our recording in a new UpdatePanel PostBackTrigger related to our download button
<triggers>
\u0026lt;asp:updatepanel id="UpdatePanel1" runat="server">
<asp:postbacktrigger controlid="ControlID">
</triggers>
Se invece il vostro controllo fosse generato a runtime, (es: un bottone inserito in GridView) sarà necessario effettuare al registrazione a runtime, dopo che il controllo è stato generato:
ScriptManager.GetCurrent(Page).RegisterPostBackControl(ImageButton1)
0 comments:
Post a Comment