In this blog post we will discuss how to integrate ASP.NET ReportViewer control in MVC3 application.
ASP.NET ReportViewer control works well in traditional Webforms (.aspx file). When I tried it in MVC 3 View (.cshtml file) it was not working.
Let’s discuss a workaround to run .NET report viewer in MVC3 application:
- Create New Report using .NET reporting system.
- Create new Webform (.aspx file) and drag ReportViewer control from toolbox on to it.
- Attach newly created report to this ReportViewer control.
- Create new controller to show this report in MVC3 application.
- Add view with razor engine (.cshtml file).
- In view file add HTML <iframe> tag to show you the report.
<iframe src=”ShowReport.aspx” width=”1000″ height=”500″ frameborder=”0″ />
- Now run this controller to show your report in MVC3 application.