【发布时间】:2014-12-15 10:51:42
【问题描述】:
这里有一个过滤报告页面,我可以在其中过滤报告的一些信息(RDLC,返回 PDF 或图像文件)。今天,这个页面总是在一个新的标签页上返回文件,因为我正在使用这个:
@using (Html.BeginForm("Report", "ReportController", FormMethod.Post, new { target = "_blank" }))
而我的ReportController返回一个FileContentResult,如下图:
return File(renderedBytes, mimeType, fileName + "." + fileNameExtension);
但是,此页面有一些服务器端验证,并且回发总是发生在新创建的选项卡上,而不是单击提交按钮的原始选项卡上。只有在 ModelState 没有错误的情况下,是否有办法返回新页面(目标 =“_blank”,生成 PDF 或图像)?如果有错误,我想在报告过滤页面上粘贴。
提前谢谢你。
【问题讨论】:
标签: c# asp.net-mvc pdf reportviewer rdlc