ASP.NET Reportviewer runtime error in MVC3

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.

Following is the Javascript error I encountered:

 The error : “Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.”

Let’s discuss a workaround to run .NET report viewer in MVC3 application:

Step 1:

  • Create New Report using .NET reporting system.

Step 2:

  • Create new Webform (.aspx file)  and drag ReportViewer control from toolbox on to it.
  • Attach newly created report to this ReportViewer control.

Step 3:

  • 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.


This entry was posted in .NET and tagged , , . Bookmark the permalink.

Leave a Reply