我有一个带有以下触发器的 UpdatePanel:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlNames" EventName="SelectedIndexChanged" />
<asp:PostBackTrigger ControlID="btnPullReport"/>
</Triggers>
当 SelectedIndexChanged 事件被触发时,我可以从 UpdateProgress 中看到我的加载 gif,但是当我单击btnPullReport
按钮时却没有。
它必须是 PostBackTrigger 类型,否则我会收到错误:
0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
btnPullReport 创建一个 Excel 文件并提示用户保存它。
btnPullReport_Click 的最后几行是:
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment; filename=Report.xlsx");
package.SaveAs(Response.OutputStream);
Response.End();
错误发生在Response.End();
并指出:{Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
我怎样才能使它在单击按钮后也显示 UpdateProgress 栏?