Search code examples
c#reporting-serviceswebformsvisual-studio-2017reportviewer

WebForms Report Viewer JavaScript Error


I get javascript errors when adding a report to an ASPX page. When clicking the view button I get javascript errors.

A simple report with a set of parameters throws the following javascript error. I'm using the local processing mode with a dynamically generated set of data sources and parameters. When I load the page without parameters, I see the following error. enter image description here

And when I add the parameters, the following exceptions will show up. enter image description here

This is the code to generate the report. The backend processing runs successfully, but when it comes to the client-side processing, it fails to display the report component.

ReportViewer1.Reset();
ReportViewer1.Visible = true;
ReportViewer1.EnableTelemetry = false;
ReportViewer1.ShowParameterPrompts = true;
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath($"~/Reports/{_reportName}");

foreach (var param in ReportParameters.Where(r => r.Hidden))
    ReportViewer1.LocalReport.SetParameters(new ReportParameter(param.Name, param.DefaultValue));

foreach (var dataset in DataSets)
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource(dataset, GetReportData(dataset)));

ReportViewer1.LocalReport.Refresh();

Update: I just noticed this issue only happens in Chrome. I've been able to open the report in IE successfully.


Solution

  • Apparently, this issue happens when a previous version of SSRS still cached in the IIS Express or IIS. A system restart resolved the issue.