Report viewer does not load, showing blank space - running local RDLC files
Asked Answered
L

10

13

I got a problem with reporting services, running local rdlc files on the 2005 version.

I have in the HTML a report viewer set to run locally as follows :

 <rsweb:ReportViewer ID="ReportingServicesReportViewer" runat="server" Height="100%"
            ProcessingMode="Local" ShowParameterPrompts="False" Width="100%">
        </rsweb:ReportViewer>

In the code

// create SqlConnection
        SqlConnection myConnection = new SqlConnection(ConnectionString);
        myCommand.Connection = myConnection;
        SqlDataAdapter da = new SqlDataAdapter(myCommand);

        //get the data
        DataSet data = new DataSet();
        da.Fill(data);

        if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0)
        {
            ReportingServicesReportViewer.Visible = true;
            ltrStatus.Text = string.Empty;

            //provide local report information to viewer
            ReportingServicesReportViewer.LocalReport.ReportPath = Server.MapPath(Report.RDLCPath);

            //bind the report attributes and data to the reportviewer
            ReportDataSource rds = new ReportDataSource("DataSet1", data.Tables[0]);
            ReportingServicesReportViewer.LocalReport.DataSources.Clear();
            ReportingServicesReportViewer.LocalReport.DataSources.Add(rds);
            ReportingServicesReportViewer.LocalReport.Refresh();
        }
        else
        {
            ReportingServicesReportViewer.Visible = false;
            ltrStatus.Text = "No data to display.";
        }

When the method to populate the report viewer with the results of the report is executed, nothing comes up as if the report viewer is not even there.

What I did to trouble shoot till now:

  • Checked the event viewer for errors and this is the only thing related which I get, [Domain]\sp_dbadmin Reason: Failed to open the explicitly specified database. . However, my user which I am connecting is a sysadmin. I have checked that and am sure because I checked the sys.server_role_members
  • I tried impersonating the logged in user, to no avail
  • I created a specific user with sysadmin rights, and gave all access rights both from IIS and also on the sql server 2008.

Has anyone encountered a problem similar to this, any ideas?

Lindsey answered 13/10, 2011 at 13:2 Comment(0)
T
8

Try using a simple report , sometimes reportviewer throws exception caused by invalid RDLC and shows an empty report.

Try also to debug the project and look at the output window in Visual Studio: you will see the warning raised bu the RDL engine, it could be useful to investigate the reason of the error.

Thundershower answered 24/10, 2011 at 7:22 Comment(0)
S
9

I had same problem with VS2012, report shows loading image and then after loading is complete, report is blank. Data exists but not rendered.

Solution : Simply change Report AsyncRendering to False and report works fine again.

Shirt answered 19/7, 2013 at 14:38 Comment(0)
T
8

Try using a simple report , sometimes reportviewer throws exception caused by invalid RDLC and shows an empty report.

Try also to debug the project and look at the output window in Visual Studio: you will see the warning raised bu the RDL engine, it could be useful to investigate the reason of the error.

Thundershower answered 24/10, 2011 at 7:22 Comment(0)
F
8

I was getting the same problem when I add parameter in rdlc but not assigning it. I solved by adding this code.

Dim p_Date As Microsoft.Reporting.WebForms.ReportParameter
p_Date = New Microsoft.Reporting.WebForms.ReportParameter("DATE", txtDate.Text)
    Me.ReportViewer1.LocalReport.SetParameters(New Microsoft.Reporting.WebForms.ReportParameter() {p_Date})
    ReportViewer1.LocalReport.Refresh()
Ferromagnetism answered 24/4, 2014 at 6:17 Comment(1)
Not the nicest code example, but you identified the issue exactly!Tumefaction
T
5

In my case, ReportViewer control does not provide error messages (EventViewer nor ReportViewer control body), just blank page. I think this make hard find and fix the issue. Yoel Halb's answer was my key!

A property called IsReadyForRendering was False. In the BOL refers to parameters topic.

I could inspect every value of the whole parameters with the code (you can execute it from immediate window)

   var parameters = ReportViewer1.LocalReport.GetParameters()

You will find the problematic parameter when you look the property State with the value "MissingValidValue"

Hope this helps !

Tauromachy answered 9/11, 2016 at 3:53 Comment(0)
M
3

I had the same problem and in my case it turned out that I have supplied the a dataset that was not the actually the object type that the report expected.

In my situation the report expected a business object, but I have supplied a SQL Data source.

I also encountered this same problem when there was parameters on the report which were not allowed to be null or blank but the parameter values was not supplied.

Also note that in order to set a data source in code it has to be done in the onload event and not in the page_load event.

Mistrial answered 9/2, 2012 at 21:11 Comment(1)
In my case I also had a problem with the report parameter being null and then it loads a blank report. Also remember to only load the report if (!this.IsPostBack) otherwise it goes into a forever loading loop.Bagging
W
2

This one took some time to figure out, so hopefully these checks will save you some time:

1) Verify the web.config

<system.web>
  <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>

  <buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </buildProviders>
</system.web>

<system.webServer>
  <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>

2) try the report viewer control directly in design view before moving any configuration into code

Hard-Coded Report Viewer Control

3) Verify that the script manager is on the page before the report viewer

4) Ensure that the report runs outside of design viewer, either locally or on the SSRS server

5) BE SURE THAT REPORT HAS DEFAULT VALUES FOR ALL PARAMETERS! Reports that require parameters and don't have default values show up blank.

Woundwort answered 27/8, 2016 at 3:39 Comment(0)
S
1

In my case the culprit was having parameters with the Allow null value = false (unchecked)... Don't asked me why.

Shaylashaylah answered 14/7, 2015 at 16:7 Comment(1)
how did you fix this? How did you set it to allow null values?Mediate
U
1

after changing size for paper or reportviewer won't work you can try my solution by adding more delay for

WaitControlDisplayAfter

sometimes your data too large to process for async

Undesirable answered 25/9, 2018 at 9:18 Comment(0)
A
0

Had the same problem. Took a while to figure out for me but it turns out I accidentally new'ed the reportViewer control myself so I lost what the Visual Studio Designer had created for me when I designed the form and that is why the reportviewer control kept coming up blank - I never set any properties on the Visual Studio Designer's ReportViewer object.

Silly mistake but took quite some time to figure out.

Algetic answered 13/8, 2015 at 15:35 Comment(0)
C
0

I've spent many days to figure out similar issue. Maybe this could help someone. I've read almost all threads on stackoverflow, but reading comments here made me try this out. In my case first two rows (parameters row and row with option to hide parameters) were shown, but rows that contain management buttons and the report itself were empty. Clicking View report resulted in no action.

preview of auto generated HTML web page

What I've done was loading the report that had parameters without providing them - I wanted user to fill them - on Page_Load.

protected void Page_Load( object sender, EventArgs e )
{
    this.LoadReport();
}

private void LoadReport()
{
        // retrieve path param from "Reports/{path}" URL
        string reportPath = Request.QueryString[ "path" ] as string;
        string reportServerUrl = System.Configuration.ConfigurationManager.AppSettings[ "ReportServerUrl" ];

        this.MainReport.ProcessingMode = ProcessingMode.Remote;
        this.MainReport.ServerReport.ReportServerUrl = new Uri( reportServerUrl );
        this.MainReport.ServerReport.ReportPath = reportPath;
        this.MainReport.ServerReport.Refresh();
}

After changing Page_Load code to the given below everything works fine.

protected void Page_Load( object sender, EventArgs e )
{
    if ( !this.IsPostBack )
        this.LoadReport();
}
Colleague answered 17/7, 2018 at 6:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.