We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

Add Subreport with Stream

Hi,
I'm trying to add a Subreport dynamically via a Stream.

I've tryed to call the method LoadSubreport directly after the LoadReport Method.
But it's not working. Every time I get this error message: "An error occurred while rendering 'SubReport' report item."

If I render the SubReport as a normal report it works.

In the path-field of the subreport control I've set the same text i pass through the LoadSubReport method


What am I doing wrong?
Can you please provide me with an example project?

Thx


5 Replies

MM Mageshyadav M Syncfusion Team February 25, 2019 10:21 AM UTC

Hi Stefan, 
 
We have validated the mention query with your shared details at our end. Please find the following code snippet to load subreport from stream, 
 
private void MainWindow_Loaded(object sender, RoutedEventArgs e) 
{ 
    viewer.ProcessingMode = ProcessingMode.Local; 
    Assembly assembly = typeof(MainWindow).GetTypeInfo().Assembly; 
    Stream reportStream = assembly.GetManifestResourceStream("ReportViewer.Reports.MainReport.rdlc"); 
    Stream subReportStream = assembly.GetManifestResourceStream("ReportViewer.Reports.SubReport.rdlc"); 
    viewer.SubreportProcessing += Viewer_SubreportProcessing; 
    viewer.LoadSubreport("SubReport", subReportStream); 
    viewer.LoadReport(reportStream); 
    viewer.DataSources.Clear(); 
    viewer.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource("TopSalesPerson", SalesPersons.GetTopSalesPerson()));    
    viewer.RefreshReport(); 
} 
private void Viewer_SubreportProcessing(object sender, Syncfusion.Windows.Reports.SubreportProcessingEventArgs e) 
{ 
    e.DataSources.Clear(); 
    e.DataSources.Add(new Syncfusion.Windows.Reports.ReportDataSource("StoreSales", StoreSales.GetData())); 
} 
 
We have created standalone sample to load subreport from the stream and it can be downloaded from the following location,    
 
Regards, 
Mageshyadav.M 



IM Imperator February 25, 2019 06:04 PM UTC

Hi,

Thanks a lot.



MM Mageshyadav M Syncfusion Team February 26, 2019 12:29 PM UTC

Hi Stefan, 
  
Thanks for your update. 
  
We hope provided solution would have helped on your side. 
  
Regards, 
Mageshyadav.M 



IM Imperator February 26, 2019 05:47 PM UTC

Hi again,
yeah thank you very much.

It helped a lot.


PR Padmini Ramamurthy Syncfusion Team February 27, 2019 05:56 AM UTC

Hi Stefan, 
  
You are welcome and please get back to us at anytime if you need any other assistance. 
  
Regards, 
Padmini 


Loader.
Live Chat Icon For mobile
Up arrow icon