Search results

Load SSRS RDL reports

Report Viewer has support to load RDL reports from SSRS Report Server. To render SSRS Reports set the reportServerUrl, reportPath, and reportServiceUrl properties as in the following code snippet.

    <div style="height: 100%; width: 100%;">
        <div style="height: 600px; width: 950px; min-height: 400px;" id="viewer"></div>
        <script type="text/javascript">
            $(function () {
                $("#viewer").ejReportViewer({
                    reportServiceUrl: "/api/SSRSReports",
                    reportPath: "/SSRSSamples/Territory Sales",
                    reportServerUrl: "http://mvc.syncfusion.com/reportserver"
                });
            });
        </script>
    </div>

You can view the Web API service used in the above code from the Reporting Service git hub location. For more information, see Samples and demos. Report Server URL should be in the format of http://<servername>/reportserver$instanceName The report path should be in the format of “/folder name/report name”.

Network credentials for SSRS

The network credentials are required to connect with the specified SSRS Report Server using Report Viewer. Specify the ReportServerCredential property in the Web API Controller OnInitReportOptions method.

public void OnInitReportOptions(ReportViewerOptions reportOption)
{
    //Add SSRS Report Server credential
    reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
}

Set data source credential for shared data sources

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.

public void OnInitReportOptions(ReportViewerOptions reportOption)
{
    //Add SSRS Report Server and data source credentials
    reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");

    reportOption.ReportModel.DataSourceCredentials.Add(new Syncfusion.Reporting.Web.DataSourceCredentials("AdventureWorks", "ssrs1", "RDLReport1"));
}

Data source credentials must be added for shared data sources that do not have credentials in the connection strings.

  • Build and run the application. Preview and edit the result using the following.
index.html
index.js
SSRSDataSourceCredentialsController.cs
    <body style="overflow: hidden; position: static; margin: 0; padding: 0; height: 100%; width: 100%;">
    <div id="viewer" style="position: absolute; height: 100%; width: 100%;"></div>
    <script src="index.js"></script>
    </body>
$(function () {
    $("#viewer").ejReportViewer({
                    reportServiceUrl: "https://reports.syncfusion.com/demos/services/api/SSRSDataSourceCredentials",
                    reportPath: "/SSRSSamples/Territory Sales",
                    reportServerUrl: "http://mvc.syncfusion.com/reportserver"
                });
});
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
    //Add SSRS Report Server and data source credentials
    reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");

    reportOption.ReportModel.DataSourceCredentials.Add(new Syncfusion.Reporting.Web.DataSourceCredentials("AdventureWorks", "demoreadonly@data-platform-demo", "N@c)=Y8s*1&dh"));
}

You can view the Web API service used in the above code from the Reporting Service git hub location. For more information, see Samples and demos.

Change data source connection string

You can change the connection string of a report data source before it is loaded in the Report Viewer. The DataSourceCredentials class provides the option to set and update the modified connection string as in the following code snippet.

        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
            reportOption.ReportModel.DataSourceCredentials.Add(new Syncfusion.Reporting.Web.DataSourceCredentials("AdventureWorks", "demoreadonly@data-platform-demo","N@c)=Y8s*1&dh","Data Source=dataplatformdemodata.syncfusion.com;Initial Catalog=AdventureWorks;"));
        }

The previous code shows an option to change the connection string only, but the class provides multiple options to change data source information. To learn more about this, refer to the DataSourceCredentials class.

Render linked reports

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.

    <div style="height: 100%; width: 100%;">
        <div style="height: 600px; width: 950px; min-height: 400px;" id="viewer"></div>
        <script type="text/javascript">
            $(function () {
                $("#viewer").ejReportViewer({
                    reportServiceUrl: "/api/SSRSReports",
                    reportPath: "/SSRSSamples/Territory Sales_Link",
                    reportServerUrl: "http://mvc.syncfusion.com/reportserver"
                });
            });
        </script>
    </div>

The Territory Sales_Link is a linked report created for Territory Sales report that is already available on the SSRS Report Server.