Basically I want to know how to embed a report into MVC.Net 2.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I did the question, because there’s not enough information on the web, or the information is not that complete so you can start working.
The first thing you have to know is that the report viewer is a webcontrol so you can’t use it on MVC, so first thing you have to do is create a web form so you can add the report viewer. In the example I’ve done I’m using Visual Studio 2010.
The webform looks like this:
The code behind of the web form:
Now we need to use the MVC. We have two options one, open a new window with a javascript pop up or use an iframe.
I will do both so you can have a best idea on the View:
**1 SessionURL is a Session Variable with the path and report we want to show. Also this is the first way to do embed the Report using an iframe
**2 /Reporting/Reports.aspx is the path of the webform we just did eaelier. This is the second way, opening a new window.
In the Controller:
**1 /Reporting/Reports.aspx is the path of the webform we just did eaelier.
Also If your are using Report Viewer 10 please remember this feature in the web.config:
Hope all this tutorial helps somebody 🙂