ASP.NET MVC + SSRS + Embeded Report
Does anyone kno开发者_如何学Gow of a method to embed a SQL Server Reporting Services(SSRS) report into an MVC application? We are using Razor Views exclusively and do not want to add any .aspx pages to our application.
You have two options:
- Render the .rdlc directly: link
- Include a web forms project along with your MVC project link
It sounds like you're not too keen on the two co-existing web-frameworks so the first option might be the best bet.
If you want basic report viewing the option would be to render in code and stream to An iftame. Since the report viewer is a server control and server controls were generally designed with web forms in mind you would be hacking it otherwise - ie you can't
Why not just include a folder for aspx? You aren't losing anything by it but a theoretical pureness to stay away from web forms which was what the control was designed for. If you want to take the hit with an .ascx contol you can include it that way buy again you are using web forms.
I had a similar request in my project. Eventually what I did is set up an ASP page that displays my reports using the ReportViewer control. I've added an MVC .cshtml file with an iframe. Using the iframe name property I have set the report.aspx into the iframe.
精彩评论