WEB API in .net core Subreport RDLC

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

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,968 questions
0 comments No comments
{count} votes

Accepted answer
  1. AniyaTang-MSFT 12,446 Reputation points Microsoft Vendor
    2023-01-10T07:00:34.163+00:00

    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. Michael Taylor 55,841 Reputation points
    2023-01-09T15:56:34.207+00:00

    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();  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.