Skip to content
Alan Juden edited this page Jan 17, 2017 · 9 revisions

For more in depth directions, head over to my blog post

If you're like me, you've been working on some ASP.NET MVC and fighting with the ASP.NET WebForms Microsoft Report Viewer control. I decided that I had had enough and wanted to build my own...so here it is! I hope you find it useful.

NuGet Repositories:

If you clone the code and run the example project in your environment, you should be able to modify the ReportController to use your credentials and your report path along with setting up one of your reports and you can see the magic happen.

Example Image

My design relies on the following Javascript libraries (but yours doesn't have to):

  • JQuery v2.1.1
  • Bootstrap v3.3.7
  • Select2 v4.0.3
  • JQuery Highlight v5 (this is optional and is used for the "Find" feature of the viewer).

I have created some very helpful code in the AlanJuden.MvcReportViewer.dll. Feel free to fork and change things however you like (I'd be interested to see what you change).

In your own web application, you're going to need to take the following steps to get it up and running:

  1. You need to have a controller that is for reports, I like to name mine "ReportController". On your ReportController, you're going to inherit from "AlanJuden.MvcReportViewer.ReportController" rather than "Controller".
    • The controller is where you will also setup your own controller actions for your reports.
  2. You also need a view that renders the Html of the report viewer control, I have been calling my view "ReportViewer.cshtml".
    • You will probably want to copy the styles and scripts out of my example ReportViewer.cshtml so that all of the buttons are mapped up for you.
    • Your ReportViewer.cshtml page will need to use a model of "AlanJuden.MvcReportViewer.ReportViewerModel".

Congratulations - pretty straight forward. No changes to the web.config at all.

Clone this wiki locally