views:

2751

answers:

4

I am getting started with ASP.NET MVC.

Is it easy or even possible to use the ReportViewer in MVC as you can with webforms? If not, what can be done?

+1  A: 

I have used the control before in a asp.net web app, the only problem is i think the version you can currently get doesn't match the version you get in the in built web reports manager, and I also think it wont load into Visual Studio 2008

for more info check out http://www.gotreportviewer.com/

beakersoft
+4  A: 

I have included a ReportViewer on an .aspx page within an MVC site for viewing reports and it works fine. Not seamless but definitely functional.

newslacker
Was this aspx page the view for a controller or was it a webforms page in an otherwise MVC application?
RonnBlack
This was a webforms page within my MVC application. I was able to dynamically assign IEnumerable datasources (LINQ to SQL) and after a little work, anonymous types. Saved me from rewriting queries as sprocs.
newslacker
+2  A: 

The ReportViewer control requires ViewState to work, so you can't place it in an MVC view. (If you try, the control will complain that ViewState is disabled and refuse to work)

This doesn't mean you can't use it in your website, however. You'll just have to mix in a little bit of classic WebForms and use the ReportViewer there.

Brant Bobby
+1  A: 

You may end up with a mixed solution since MVC is very different from your typical web app. So part of your solution ends up being "classic" asp.net to support the report viewer and part would be MVC.

etechpartner