1
所以,我有以下情形:ASP.NET:Response.BinaryWrite內UpdatePanel內兒童用戶控制
--- Page.aspx ---
UpdatePanel
ListView
UserControl.ascx
--- UserControl.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:從無法解析服務器收到的消息。」
您無法下載文件通過JAX。 – SLaks 2013-02-25 19:45:15
@SLaks我需要更新面板有反正我可以解決這個問題嗎? – 2013-02-25 20:26:21
不需要您需要回傳。 – SLaks 2013-02-26 00:42:14