我有下一个观点代码:
@{ Layout = null; }
@Html.Raw(ViewBag.ReportHeader as string)
@{
Response.Buffer = true;
Response.Flush();
}
@Html.Raw(ViewBag.ReportBodyAndFoot as string)
在这种情况下,我希望首先呈现页面的标题,然后使用页脚呈现主体,但响应会发送整个页面。
答案 0 :(得分:5)
我找到了答案:
public ActionResult Index(DateTime from, DateTime to)
{
PartialView("PartialViews/_ReportHeader").ExecuteResult(ControllerContext);
Response.Flush();
ViewBag.Report = new InHouseFarmInFarmOutReportGenerator().GenerateReport(from, to);
return View();
}