How to load SubReport in Syncfusion JavaScript ReportViewer?
This article describes how to load the Subreport in the jQuery ReportViewer. You can also refer to the Getting Started with jQuery ReportViewer from the User Guide, available in the following link:
https://help.syncfusion.com/js/reportviewer/getting-started
Loading SubReport in JavaScript ReportViewer:
The following steps help you to load a RDLC report with SubReport item,
- As per RDL standard, you can set the SubReport Path and properties like as MS ReportViewer as shown in below screenshot,
- You can pass the Datasource values to Sub Report on Report Loaded method as shown in the below example,
public void OnReportLoaded(ReportViewerOptions reportOption) { if (reportOption.SubReportModel != null) { reportOption.SubReportModel.DataSources.Add(new ReportDataSource { Name = "StoreSales", Value = StoreSales.GetData() }); } else { reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "TopSalesPerson", Value = SalesPersons.GetTopSalesPerson() }); } }
SubReport Model Properties:
The ReportViewer has the following subreport properties.
DataSources | Gets/sets the datasources of the subreport. |
DataSourceName | Gets the datasources names of the subreport. |
Parameters | Gets/sets the parameters to the subreport. |
ReportPath | Gets/sets the Report Path of the subreport. |
Stream | Sets the report stream for the subreport. |
Run the Application:
Run the sample application and you can see the output of the RDLC subreport loading as displayed in the following screenshots:
Demo Sample
You can download the Demo Sample from the following link.
https://www.syncfusion.com/downloads/support/directtrac/general/ze/SubReportSample-928161950.zip
Further References
You can find documentation and demo samples for JavaScript ReportViewer Control from the following links.
https://js.syncfusion.com/demos/web/
https://help.syncfusion.com/js/overview
Conclusion
I hope you enjoyed learning about how to Load SubReport in Syncfusion ReportViewer.
You can refer to our jQuery ReportViewer feature tour page to know about its other groundbreaking feature representations.
For current customers, you can check out our jQuery components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our jQuery ReportViewer and other jQuery components.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!