首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XtraReport没有显示任何数据

XtraReport没有显示任何数据
EN

Stack Overflow用户
提问于 2015-08-17 02:23:30
回答 2查看 807关注 0票数 1

我遵循了本文档链接中的说明。xtrareport显示框工具栏,但不显示任何数据。我做错了什么?

In my HomeController.cs

代码语言:javascript
复制
 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

代码语言:javascript
复制
**@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

代码语言:javascript
复制
{
    ViewBag.Title = "Home Page";

}
@ViewBag.Message

@Html.Action("DocumentViewerPartial")
EN

回答 2

Stack Overflow用户

发布于 2015-09-17 03:42:51

通过使用DocumentViewerPartial.cs ViewData["Reports"]更改ViewData["Report"]来尝试

票数 0
EN

Stack Overflow用户

发布于 2017-03-30 06:40:49

在XtraReport1里你是怎么写的?如果您提供您的代码XtraReport1或向我们提供一个简单的用案例演示的示例,那就太好了。我在你的控制器中看到了,如果你写的话,它会得到数据第三:ViewData“报告”=新的DXApplication.Reports.XtraReport1();

  1. 索引()中的第一个
  2. DocumentViewerPartial()中的第二个
  3. ExportDocumentViewer()中的第三个

准备好了,您只需要第一次获得数据,您可以写:

代码语言:javascript
复制
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中,您可以编辑:

代码语言:javascript
复制
@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文件中完成以下操作:

代码语言:javascript
复制
@Html.Partial("ExportDocumentViewer")
@Html.Partial("DocumentViewerPartial")

请执行相应的修改,并让我知道您的结果。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32041946

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档