WEB API in .net core Subreport RDLC

asked 2023-01-09T15:23:24.457+00:00
Dhruv Parmar 21 Reputation points

Can someone help me with how to bind Subreport with main report in web api in .netcore

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,096 questions
No comments
{count} votes

Accepted answer
  1. answered 2023-01-10T07:00:34.163+00:00
    AniyaTang 2,026 Reputation points Microsoft Employee

    Hi @Dhruv Parmar I found these links for you, maybe you can use them as a reference. https://help.boldreports.com/report-viewer-sdk/aspnet-core-reporting/report-viewer/subreport/ https://www.bing.com/videos/search?q=bind+Subreport+with+main+report+in+web+api+in+.netcore&docid=603545348665920125&mid=FB0BFAD4BAECABD8437CFB0BFAD4BAECABD8437C&view=detail&FORM=VIRE Best regards, Aniya


1 additional answer

Sort by: Most helpful
  1. answered 2023-01-09T15:56:34.207+00:00
    Michael Taylor 37,456 Reputation points

    Please provide us more information and the code you're using. It sounds like you want to programmatically associate a subreport with another report using the RLDC infrastructure. But when you defined your RDLC you would have set this up already, otherwise how would the report server know what to generate. All you generally need to do is set the data source(s) in each report and subreport and then render. Here's some (non-tested) code that demonstrates what I'm talking about.

       var report = new LocalReport();  
       report.DataSources.Add(someData);  
       report.ReportPath  = @"myreport.rdlc";  //Assuming the report is directly in the binary path, if not then you need to resolve the relative path to the report  
       report.SubreportProcessing += (o, e) => {  
          //Get parameter(s) if any  
          var parmId = Convert.ToInt32(e.Parameters[0].Values[0]);  
          var ds = new ReportDataSource("MyDS", someMoreDataBasedOnParmId);  
          e.DataSources.Add(ds);  
       };  
         
       //Assuming you are using ReportViewer somewhere in your code  
       _viewer.LocalReport = report;  
       _viewer.Refresh();  
       _viewer.RefreshReport();