In VS2010 Beta 2, the Web Report Viewer does not display the content of the report

烂漫一生 提交于 2019-12-09 12:53:46

问题


In VS2010 Beta 2, the Web Report Viewer does not display the content of the report, whether I use Local or Remote mode.

It only display the following "disabled" bar [image]

The report I created works fine in the Report Server.

Here is the code for displaying the report:

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

Or

        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();

And I've already added the ScriptManager to the webpage, and the corresponding handlers entries in the web.config (both in system.web and system.webServer section).

The same code works fine in VS2008.

Anyone encountered the same issue?


回答1:


Prior to Beta 2, VS came loaded with Report Viewer 9.0 (same as in VS 2008). Beta 2 uses Report Viewer 10.0 which handles asynchronous rendering differently (using ASP.Net AJAX vs. rendering content in an iframe). Is the reportviewer showing the loading indicator indefinitely? If so, then you probably have some code in your page's load event that is telling the ReportViewer to restart report processing. If you do this every postback then the viewer gets stuck in an infinite loop. Simply adding a check of IsPostBack to your page's load event should fix this problem.

For more, see "Reports Never Stop Loading With VS 2010" in Brian Hartman's Report Viewer Blog.




回答2:


just use

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

to avoid ReportViewer infinite loading loop with reportviewer version 10.0.0 and VS2010 and using SSRS2008




回答3:


Same problem...

We've added a reportviewer control to a page which is derived from a custom base form. On this base form we override the RenderChildren method. As example see article: http://msdn.microsoft.com/en-us/library/system.web.ui.control.renderchildren.aspx

We've had no problems with this prior to Beta 2, and our framework heavily relies on this functionality.




回答4:


I had this same issue and MattSlay's answer made me realize the Refresh method has to be called only when the page is not a postback, my working 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();
        }
    }


来源:https://stackoverflow.com/questions/1772557/in-vs2010-beta-2-the-web-report-viewer-does-not-display-the-content-of-the-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!