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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add Subreport with Stream

Thread ID:

Created:

Updated:

Platform:

Replies:

142871 Feb 23,2019 03:46 PM UTC Feb 27,2019 05:56 AM UTC WPF 5
loading
Tags: ReportViewer
Imperator
Asked On February 23, 2019 03:46 PM UTC

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


Mageshyadav M [Syncfusion]
Replied On 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 


Imperator
Replied On February 25, 2019 06:04 PM UTC

Hi,

Thanks a lot.


Mageshyadav M [Syncfusion]
Replied On 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 


Imperator
Replied On February 26, 2019 05:47 PM UTC

Hi again,
yeah thank you very much.

It helped a lot.

Padmini Ramamurthy [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;