所以我有以下场景:
--- 页面.aspx ---
UpdatePanel
ListView
UserControl.ascx
--- 用户控件.ascx ---
ListView
Button|ID:btnDownloadAttachment
我使用以下方法下载附件:
public void OpenDocument(byte[] AttContent, string fileName, string inExtension)
{
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + inExtension);
Response.AddHeader("Content-Length", AttContent.Length.ToString());
Response.BinaryWrite(AttContent);
}
但由于内容在更新面板内,我收到以下错误:
“Sys.WebForms.PageRequestManagerParserErrorException:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息。”