Report Viewer has support to load RDL reports from SSRS Report Server. To render SSRS Reports set the ReportServerUrl
and ReportServerCredential
properties as in the following code snippet.
this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer";
this.ReportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.ReportViewer.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
this.ReportViewer.ReportPath = "/SSRSSamples/Territory Sales"; //The report path should be in the format of "/folder name/report name"
this.ReportViewer.RefreshReport();
The SSRS Report Server does not provide options to get credential information of the report data source deployed on the SSRS server. If the report has any data source that uses credentials to connect with the database, then you must specify the DataSourceCredentials
for each report data source to establish database connection.
this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer";
this.ReportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.ReportViewer.ReportPath = "/SSRSSamples/Territory Sales"; //The report path should be in the format of "/folder name/report name"
this.ReportViewer.RefreshReport();
To set shared datasource credentials in Web API Controller, use the following code in the OnReportLoaded
method.
[NonAction]
public void OnReportLoaded(ReportViewerOptions reportOption)
{
//Add SSRS Report Server and data source credentials
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials("<database>", "ssrs1", "RDLReport1"));
}
You can render a linked report that point to an existing report, which is published in the SSRS Report Server. Also, it is possible to set the parameter, data source, credential, and other properties as like normal SSRS reports using the Report Viewer.
this.ReportViewer.ReportServiceURL = @"https://demos.boldreports.com/services/api/ReportViewer";
this.ReportViewer.ReportServerUrl = "http://<servername>/reportserver$instanceName";
this.ReportViewer.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
this.ReportViewer.ReportPath = "/SSRSSamples/Territory Sales_Link"; //The report path should be in the format of "/folder name/report name"
this.ReportViewer.RefreshReport();
The
Territory Sales_Link
is a linked report created forTerritory Sales
report that is already available on the SSRS Report Server.