我遵循了本文档链接中的说明。xtrareport显示框工具栏,但不显示任何数据。我做错了什么?
In my HomeController.cs
public ActionResult Index()
{
ViewBag.Message = "Welcome to DevExpress Extensions for ASP.NET MVC!";
ViewData["Report"] = new DXApplication.Reports.XtraReport1();
return View();
}
public ActionResult DocumentViewerPartial()
{
ViewData["Report"] = new DXApplication.Reports.XtraReport1();
return PartialView("DocumentViewerPartial");
}
public ActionResult ExportDocumentViewer()
{
return DevExpress.Web.Mvc.DocumentViewerExtension.ExportTo(new DXApplication.Reports.XtraReport1());
}DocumentViewerPartial.cs
**@Html.DevExpress().DocumentViewer(settings =>
{
settings.Name = "DocumentViewer";
settings.Report = (DXApplication.Reports.XtraReport1)ViewData["Reports"];
settings.CallbackRouteValues = new { Controller = "Home", Action = "DocumentViewerPartial" };
settings.ExportRouteValues = new { Controller = "Home", Action = "ExportDocumentViewer" };
}).GetHtml()**和Index.cshtml
{
ViewBag.Title = "Home Page";
}
@ViewBag.Message
@Html.Action("DocumentViewerPartial")发布于 2015-09-17 03:42:51
通过使用DocumentViewerPartial.cs ViewData["Reports"]更改ViewData["Report"]来尝试
发布于 2017-03-30 06:40:49
在XtraReport1里你是怎么写的?如果您提供您的代码XtraReport1或向我们提供一个简单的用案例演示的示例,那就太好了。我在你的控制器中看到了,如果你写的话,它会得到数据第三:ViewData“报告”=新的DXApplication.Reports.XtraReport1();
准备好了,您只需要第一次获得数据,您可以写:
public ActionResult Index()
{
ViewBag.Message = "Welcome to DevExpress Extensions for ASP.NET MVC!";
return View();
}
public ActionResult DocumentViewerPartial()
{
Session["Report"] = new DXApplication.Reports.XtraReport1();
return PartialView("DocumentViewerPartial");
}
public ActionResult ExportDocumentViewer()
{
return DevExpress.Web.Mvc.DocumentViewerExtension.ExportTo(Session["Report"] as XtraReport1());
}在DocumentViewerPartial.cs中,您可以编辑:
@Html.DevExpress().DocumentViewer(settings =>{
settings.Name = "DocumentViewer";
settings.Report = (DXApplication.Reports.XtraReport1)Session["Reports"];
settings.CallbackRouteValues = new { Controller = "Home", Action = "DocumentViewerPartial" };
settings.ExportRouteValues = new { Controller = "Home", Action = "ExportDocumentViewer" };}).GetHtml()然后在您调用的Index.cshtml文件中完成以下操作:
@Html.Partial("ExportDocumentViewer")
@Html.Partial("DocumentViewerPartial")请执行相应的修改,并让我知道您的结果。
https://stackoverflow.com/questions/32041946
复制相似问题