Here you will find the steps:
Step 1
Below, you will find the table used in the application.

After creating the table, you can fill it using, for example, the data rows as shown below:
Step 2
Open Visual Studio, and Add New Project.


Step 3
Add Report file (.rdlc).
Now, you need to add a report file (.rdlc). Right click on project name and then Add> Add New Item > Reporting > Report > Add.

In this part, we need to configure our Report View with the fields which you want to add in the report. In this case, I chose to add all fields of my table.

Step 4
Configuring Dataset.
Here, we need to repeat the following steps for getting the same result.





After finishing the steps shown below, we will pass to the next step.
Step 5
Add Entity Data Model.
Right click on project name from solution explorer, then Add > New Item > Select ADO.Net Entity Data Model > Add.




Step 6
Add a View with .Aspx extension into the shared Folder.
Right Click on shared folder > Add > New Item >View Page (ASPX).
Step 7
You will add Report Viewer and Script Manager Controls from ToolBoxpanel as shown below.

Now, write the code between the head tag as follow.
- <headrunat="server">
- <metaname="viewport"content="width=device-width"/>
- <title> Data Report With MVC 4</title>
- <scriptrunat="server">
- void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- List<ReportViewerMVC.Customers> customers = null;
- using (ReportViewerMVC.EntityFrameworkTestEntities _entities = new ReportViewerMVC.EntityFrameworkTestEntities())
- {
- customers = _entities.Customers.ToList();
- ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/MyReport.rdlc");
- ReportDataSource RDS = newReportDataSource("DataSet1", customers);
- ReportViewer1.LocalReport.DataSources.Add(RDS);
- ReportViewer1.LocalReport.Refresh();
- }
- }
- }
- </script>
- </head>
Add New Controller.
Right click on the Controllers folder > Add > Controller > Enter Controller name (“Customers”) > Add. By default we have index action as follows.
- publicclassCustomersController: Controller
- {
- //
- // GET: /Customers/
- publicActionResult Index()
- {
- return View();
- }
- }
Add view related to Index Action.
At this level, we need to click on form action > Add View > Enter View name (Index)> Add.
Index.cshtml
- @{
- ViewBag.Title = "Display Data in the Report Viewer";
- }
- <h2>Display Data in the Report Viewer</h2>
- @* Here we call the page that I have been created into shared folder *@
- @Html.Partial("DataReport")
Run Application.


Aj DhavalePosted Jun 21, 2018, 10:29 PM EDT
I have the next error while calling index method.... Error=The view at '~/Views/Shared/Myview.aspx' must derive from ViewPage, ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.
Ahmed AbdiPosted Sep 28, 2017, 8:55 AM EDT
Nice article thanks for the share
Pablo FotiPosted Jun 28, 2017, 8:36 AM EDT
Thanks a lot! i have the next error: Error de configuraci?n del visor de informesEl controlador HTTP de controles web del visor de informes no est? registrado en el archivo web.config de la aplicaci?n. Agregue <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> a la secci?n system.web/httpHandlers del archivo web.config, o bien agregue <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> a la secci?n system.webServer/handlers para Internet Information Services 7 o posterior.
Santhakumar MunuswamyPosted Jun 24, 2016, 11:09 PM EDT
Nice share
C# CornerPosted Jun 15, 2016, 2:58 AM EDT
Hi Mahdi Ar, nice article, thanks for sharing. For those who don't know, another possibility for showing Report Viewer reports in MVC websites is to use the "ReportViewer for MVC" library. You can find it in CodePlex: https://reportviewerformvc.codeplex.com/
Kuppurasu NagarajTOP 100Posted Jun 14, 2016, 9:16 AM EDT
Nice Sharing..
Vignesh ManiTOP 100Posted Jun 14, 2016, 8:14 AM EDT
Nice
RajaPosted Jun 12, 2016, 8:34 PM EDT
Nice Sharing...
Debasis SahaTOP 100Posted Jun 12, 2016, 8:14 PM EDT
Nice share..
Deeksha PanditPosted Jun 12, 2016, 10:18 AM EDT
Thanks for sharing . Nice article