How i can create report viewer get data from database in Asp Net MVC?
Loading
How i can create report viewer get data from database in Asp Net MVC?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajkiran SwainPosted Mar 29, 2023, 8:33 PM
To create a report viewer and get data from the database in an ASP.NET MVC application, you can follow these steps:
Create a new
ReportViewercontrol in your view page:In your controller, create a method that retrieves data from the database and returns it in a
DataTable:Make sure to replace
your_connection_string_here,your_table_here,your_report_name_here, andDataSet1with the appropriate values for your application.Also, make sure that the report file exists in the
Reportsfolder in your application and that its name and path are correct in the code.Amit MohantyPosted Mar 29, 2023, 4:22 AM
First install the below NuGet packages to your project:
Create a new ASP.NET MVC Controller that will handle the report viewer request. In this controller, you will write the code to retrieve data from the database and populate the report.
Create a new Report Definition (.rdlc) file in your ASP.NET MVC project. In this file, you will define the layout and structure of the report.
Add a new View to your ASP.NET MVC project that will display the report viewer control. In this view, you will add the report viewer control and configure it to load the report definition file and retrieve data from the controller.
Here is an example. Controller code:
View code:
Vishal YelvePosted Mar 28, 2023, 4:51 PM
Hi,
Refer below links
https://www.aspsnippets.com/Articles/Implementing-RDLC-Reports-in-ASPNet-MVC.aspx
https://www.boldreports.com/blog/how-to-add-the-report-viewer-to-an-aspnet-mvc-application
https://www.c-sharpcorner.com/article/display-data-in-report-viewer-with-mvc-4/
Pasang TamangPosted Mar 28, 2023, 3:35 PM
Hi,
Please refer to this link https://www.c-sharpcorner.com/article/display-data-in-report-viewer-with-mvc-4/. I hope this helps to you.
Regards
Pasang