Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Report Viewer Control (Web) Shows Blank Report

I have a web form containing a ReportViewer control, a DIV element so I can see that the page actually renders. I see that my page properly loads, I see the report service being accessed in Fiddler, but there is never anything displayed.

At present, I'm using a report with static text, no queries on it, in order to ensure that I isolate the issue.

My page is as follows:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer.aspx.cs" Inherits="PeopleNet.Web.Views.Reports.ReportViewer" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="~/scripts/jquery-1.7.2.js" />
                <asp:ScriptReference Path="~/scripts/fixReportViewer.js" />
            </Scripts>
        </asp:ScriptManager>

        <div>
            This is the report viewer page...
        </div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>
    </form>
</body>
</html>

The code to display the report is:

protected void Page_Load(object sender, EventArgs e)
{
    this.ReportViewer1.ServerReport.ReportServerUrl = ConfigurationFacade.ReportServerUri;
    this.ReportViewer1.ServerReport.ReportPath = { path to report name };
    this.ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials(); // custom class implementing IReportServerCredentials as described in various places around the web, including SO
    this.ReportViewer1.ServerReport.Refresh();
}

My web.config file is configured with the HttpHandlers as required:

<system.web>
    <!-- abbreviated... -->
    <httpHandlers>
        <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
    </httpHandlers>
</system.web>

And :

<system.webServer>
    <!-- abbreviated... -->
    <handlers>
        <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>
</system.webServer>

The server runs Windows 2008 and SQL Server 2008 R2.

I am using the SQL Server 2012 version of the viewer, as we are in the process of updating our environments to 2012.

I have repeatedly verified that the report is accessible from the ReportManager, with no issues whatsoever.

I have been attempting to access this in IE9, having seen various issues stated with other browsers.

I am presently (for testing only) passing my credentials as the report server credentials. I am a Reporting Services Administrator, as well as a member of the server administrators group on the server.

I have checked both the event log and the ReportServerService log, and have found nothing amiss.

UPDATE: Looks like when change the AsyncRendering to false, and ensure that I don't try to "SetParameters" with an empty collection, this gets mostly cleared up:

this.ReportViewer1.AsyncRendering = false;

What am I missing in the configuration/code here?

like image 674
reallyJim Avatar asked Oct 11 '12 20:10

reallyJim


People also ask

What is Report Viewer control?

Report viewer controls are . NET controls that can be added to a form in a Windows or Web application, to display reports on that form.


2 Answers

My solution to this issue was related to trying to set the report viewer height to 100%. This resulted in no report showing. Changing the height to a px value (ie 900px) got the reportviewer working.

like image 81
John M Avatar answered Oct 18 '22 04:10

John M


There is this blog entry on MSDN that discusses how asynchronous rendering works.

Additionally, it mentions that (as was said in the comments) synchronous rendering embeds the content in the page, while asynchronous rendering renders the content in a frame. The size of the frame is "difficult...to calculate" and the SizeToReportContent property is ignored.

Since your report won't display unless it is synchronously rendered, the issue must be in the use of frames.

In the article mentioned in the comments, asynchronously rendering the report will collapse the control height to zero pixels if a relative height is used. This could explain why nothing is displayed. You might try specifying a height for the control. There are other suggestions in that article as well.

That's assuming that your issue is in the SQL Server 2008 R2 SSRS version, which I believe draws from VS 2008. SQL Server 2012 SSRS I think draws on VS 2010, which is not supposed to have those issues, so when you finish your upgrade, this issue might go away.

like image 1
Kit Z. Fox Avatar answered Oct 18 '22 06:10

Kit Z. Fox