I have followed the instructions from this documentation link . The xtrareport shows the box toolbar but it doesnot shows any data. What am I doing wrong?
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()**
And Index.cshtml
{
ViewBag.Title = "Home Page";
}
@ViewBag.Message
@Html.Action("DocumentViewerPartial")
尝试通过使用ViewData["Report"]
更改DocumentViewerPartial.cs ViewData["Reports"]
ViewData["Report"]
In XtraReport1 how do you write? it would be great if you provide your code XtraReport1 or provide us with a simple demonstrating with case. I saw in your Controller, if you write that, it will get data 3rd: ViewData["Report"] = new DXApplication.Reports.XtraReport1();
Ready you only need get data 1st, you can write:
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());
}
And in DocumentViewerPartial.cs you edit:
@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()
Then final in file Index.cshtml you call:
@Html.Partial("ExportDocumentViewer")
@Html.Partial("DocumentViewerPartial")
Please perform the corresponding modifications and let me know your results.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.