Response.WriteFile出現PageRequestManagerParserErrorException的解決方法

Response.WriteFile 出現PageRequestManagerParserErrorException 的解決方法

 

調用代碼:

FileNameOutput = HttpUtility .UrlEncode(FileNameOutput, System.Text.Encoding .UTF8);

Response.Clear();

Response.ContentType = "application/octet-stream" ;

Response.AddHeader("Content-Disposition" , "attachment;filename=" + FileNameOutput);

Response.WriteFile(LocalFilePath);

 

頁面使用了 Ajax 部分刷新技術, Response.WriteFile 要求全頁面提交。

因爲頁面中用到了 GridView ,將

< Triggers >

    < asp : PostBackTrigger ControlID ="btnExportExcel" />

</ Triggers >

添加到 GridView 中即可。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章