How to create RDLC report in asp.net core mvc 5 with Report Viewer
Loading
How to create RDLC report in asp.net core mvc 5 with Report Viewer
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajkiran SwainRank #165 · 14.4K reputationPosted Jun 26, 2023, 2:27 AM EDT
Step 1: Install the necessary packages
Microsoft.ReportingServices.ReportViewerControl.WebFormspackage from NuGet. This package provides the Report Viewer control for ASP.NET Core.Step 2: Create a new RDLC report
Step 3: Configure Report Viewer in the View
Step 4: Configure the controller action to render the report
using Microsoft.Reporting.WebForms; public class ReportController : Controller { public IActionResult Index() { // Create a new LocalReport object LocalReport localReport = new LocalReport(); // Specify the path to the RDLC report file string reportPath = Path.Combine(Server.MapPath("~/Reports"), "YourReport.rdlc"); localReport.ReportPath = reportPath; // Set the data source for the report (e.g., retrieve data from a database) // ... // Set the report parameters if needed // ... // Render the report into a byte array byte[] reportBytes = localReport.Render("PDF"); // Return the report as a FileResult return File(reportBytes, "application/pdf", "Report.pdf"); } }Make sure to replace "YourReport.rdlc" with the actual filename of your RDLC report.
Step 5: Configure the route to the controller action
Startup.csfile, add a route to map the URL to the controller action:app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "report", pattern: "report", defaults: new { controller = "Report", action = "Index" }); });With these steps, you should be able to create and display an RDLC report in ASP.NET Core MVC 5 using the Report Viewer control.
Mayooran NavamanyRank #438 · 5.7K reputationPosted Jun 26, 2023, 3:20 AM EDT
Read below the Articles it's helpful for you
01. https://www.c-sharpcorner.com/UploadFile/1e050f/create-rdlc-reports-in-Asp-Net-web-applicationwebsite/
02. https://help.boldreports.com/report-viewer-sdk/aspnet-core-reporting/report-viewer/how-to/create-rdlc-report/
03. https://www.aspsnippets.com/Articles/Implementing-RDLC-Reports-in-ASPNet-MVC.aspx