【问题标题】:In VS2010 Beta 2, the Web Report Viewer does not display the content of the report在 VS2010 Beta 2 中,Web Report Viewer 不显示报表的内容
【发布时间】:2010-12-18 20:34:09
【问题描述】:

在 VS2010 Beta 2 中,无论我使用本地模式还是远程模式,Web Report Viewer 都不显示报告的内容。

它只显示以下“禁用”栏[image]

我创建的报告在报告服务器中运行良好。

这是显示报告的代码:

        ReportViewer1.ProcessingMode = ProcessingMode.Remote;
        ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/reportserver");
        ReportViewer1.ServerReport.ReportPath = "/MyReports/Report1";
        ReportViewer1.ServerReport.Refresh();

或者

        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report1.rdlc");
        ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", myDataSet);
        ReportViewer1.LocalReport.Refresh();

我已经将 ScriptManager 添加到网页中,并在 web.config 中添加了相应的处理程序条目(在 system.web 和 system.webServer 部分中)。

相同的代码在 VS2008 中运行良好。

有人遇到过同样的问题吗?

【问题讨论】:

    标签: .net reporting-services reportviewer visual-studio-2010


    【解决方案1】:

    在 Beta 2 之前,VS 加载了 Report Viewer 9.0(与 VS 2008 相同)。 Beta 2 使用 Report Viewer 10.0,它以不同的方式处理异步呈现(使用 ASP.Net AJAX 与在 iframe 中呈现内容)。报告查看器是否无限期地显示加载指示器?如果是这样,那么您的页面加载事件中可能有一些代码告诉 ReportViewer 重新开始报告处理。如果每次回发都这样做,那么查看器就会陷入无限循环。只需在页面的加载事件中添加对 IsPostBack 的检查即可解决此问题。

    有关详细信息,请参阅 Brian Hartman 的报告查看器博客中的“Reports Never Stop Loading With VS 2010”。

    【讨论】:

      【解决方案2】:

      只需使用

      if(!isPostBack)
      {
      //your code here
      }
      

      为了避免 ReportViewer 无限加载循环与 reportviewer 版本 10.0.0 和 VS2010和使用SSRS2008

      【讨论】:

        【解决方案3】:

        同样的问题...

        我们已将报表查看器控件添加到派生自自定义基本表单的页面。在这个基本表单上,我们重写了 RenderChildren 方法。例如见文章:http://msdn.microsoft.com/en-us/library/system.web.ui.control.renderchildren.aspx

        在 Beta 2 之前,我们对此没有任何问题,而且我们的框架严重依赖此功能。

        【讨论】:

          【解决方案4】:

          我遇到了同样的问题,MattSlay 的回答让我意识到只有当页面不是回发时才必须调用 Refresh 方法,我的工作 Page_Load:

              protected void Page_Load(object sender, EventArgs e)
              {
                  if (!IsPostBack)
                  {
                      MainReportViewer.ProcessingMode = ProcessingMode.Remote;
                      string reportName = this.Request.QueryString["ReportName"];
                      MainReportViewer.ServerReport.ReportPath = "/Pulse Reports/" + reportName;
                      MainReportViewer.ServerReport.ReportServerUrl = new Uri("http://10.1.0.48/ReportServer");
                      MainReportViewer.ServerReport.Refresh();
                  }
              }
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-08-26
            • 2016-04-09
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多