Geeks With Blogs
Ilya Verbitskiy Thoughts and links about computer programming

SQL Server Reporting Services is rich and popular reporting solution that you have free with SQL Server. It is widely used in the industry: from small family businesses running on SQL Server 2008/2012 express to huge corporations with SQL Server clusters.

There is one issue with the solution. Microsoft has not release SSRS viewer for ASP.NET MVC yet. That is why people usually mixing modern ASP.NET MVC enterprise applications with ASP.NET Web Forms pages to view report.

Today I released ASP.NET MVC HTML helper which renders a basic ASP.NET Web Forms ReportViewer control inside an iframe.

You can get it from NuGet. The package name is MvcReportViewer.

The documentation and source code are available on GitHub under MIT license: https://github.com/ilich/MvcReportViewer.

Bug reports, patches and other contributions are welcome!

Posted on Monday, November 4, 2013 7:01 PM SQL Server , ASP.NET , Projects | Back to top


Comments on this post: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi ilya.. I cant get the sample project working.. there's no Reports folder
Left by Hayu Rahiza on Nov 24, 2013 9:21 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi,

That's what you should do.

1. Setup SSRS and create a report there. You can do it even with SSRS web-itenrface.

2. Change sample code to use your SSRS server and your report's URL.

3. Run sample application.
Left by Ilya on Nov 25, 2013 4:31 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi, thanks for this wrapper, it works really well. One question I have, is there an easy way to access the other properties (e.g. ShowExportControls, ShowPrintButton, DocumentMapCollapsed etc) of the ReportViewer control using your helper?

Many Thanks
Left by Mike on Nov 25, 2013 11:00 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Mike,

These features are not supported at the moment. I will think about adding a generic support for these properties in the next version.

The quick solution for you problem is adding required parameters directly to MvcReportViewer.aspx page.

Thank you for you interest to the project.
Left by Ilya on Nov 25, 2013 5:56 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Ilya,

Thanks for the suggestion, I'll try that.

Mike
Left by Mike on Nov 26, 2013 10:09 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Ilya,

The sample project works fine. It's just that I enter wrong value in ReportServerUrl appSetting. I have been confuse with Web Service URL and Report Manager URL. Web Service URL is the correct one.
Left by Hayu Rahiza on Nov 28, 2013 4:34 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Ilya,
Left by henley on Nov 29, 2013 11:01 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
$(document).ready(function () {
$('#ReportForm').ajaxForm(function (html) {

var src1 = $(html).attr("src");

$("iframe", parent.document.body).attr("src", src1);

});
});

报表查看器 Web 控件 HTTP 处理程序尚未在应用程序的 web.config 文件中注册。请将 <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> 添加到 web.config 文件的 system.web/httpHandlers 节,或者将 <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> 添加到 Internet Information Services 7 或更高版本的 system.webServer/handlers 节。
Left by henley on Nov 29, 2013 11:04 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Henley,

Unfortunately I do not speak Chinese (Google translate recognized characters as Chinese. I am sorry if I am wrong). I think you application did not have a reference to ReportViewer Web Control or Web.config has not been configured properly.

So, please add Microsoft.ReportViewer.WebForms(Version = 11.0) to your project. Then double check that your web.config has all needed settings.

Web.config configuration description:
http://msdn.microsoft.com/en-us/library/ms251661(v=vs.110).aspx
Left by Ilya on Nov 29, 2013 11:49 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Is there any way to pass the wrapper a list of Key,Value pairs? We deal with a lot of parameters that have more than 1 value and we gather the parameters from a separate view, which gives them to us in a list like this:

List<KeyValuePair<string,string>>()
{
{"Parameter1", "value1"}
{"Parameter1", "value2"}
{"Parameter2", "value1"}
{Parameter2", "value2"}
}
Left by Matt on Dec 02, 2013 5:59 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Matt,

It is not possible yet. I think it is a good enhancement. I created a ticket for that: https://github.com/ilich/MvcReportViewer/issues/5
Left by Ilya on Dec 02, 2013 11:59 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...

new {
parameter="[日期].[年季月日].[年].&[2000].&[Q1].&[01月].&[1],[日期].[年季月日].[年].&[2000].&[Q1].&[01月].&[2],[日期].[年季月日].[年].&[2000].&[Q1].&[01月].&[3],........"
}

When Parameter 's value is too long.
How to solve?
Left by henley on Dec 12, 2013 10:43 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
I am afraid you cannot have too long parameters. The problem is we are passing SSRS parameters via iframe URL. It is GET request. All browsers have limitations to the size of GET requests.

Some useful information might be found here: http://stackoverflow.com/questions/2659952/maximum-length-of-http-get-request

I will take a look to the ticket you have created on GitHub once I have time. For the time being you could try to modify MvcReportViewer.aspx page: reduce GET request size (e.g. use some special encoding) and add additional formation to the ReportViewer control directly in MvcReportViewer.aspx page.
Left by Ilya on Dec 13, 2013 2:59 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Can you passing parameters through Session?
Left by henley on Dec 14, 2013 2:18 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
No, you cannot. We use anonymous objects to pass report parameters. You can store this object to ASP.NET InProc session storage, but you cannot do that with Session Server or SQL Server. They require objects to be annotated with Serializable attribute.
Left by Ilya on Dec 15, 2013 2:00 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
I will try to use POST request to send long values. I think it should work. The change will be available with the next release. I hope it will be this month, once I will have time.
Left by Ilya on Dec 15, 2013 2:05 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Great stuff. POST request (to send long values) will add lot of values to this wrapper.
Left by Shubhkaran on Dec 30, 2013 10:55 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
POST request has been already implemented, but it is not published on NuGet yet. The code is available on GitHub.

I am going to publish the next version after I will implement few more features.
Left by Ilya on Dec 30, 2013 11:02 AM

# How to Create Reports in MVC4
Requesting Gravatar...
Can anybody tell me how to create reports in MVC4 UI Part and how to add .rdl file to Web Part.
Left by suresh on Jan 08, 2014 8:11 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
The Helper does not support local rendering yet. I am thinking about adding this feature in for future releases, but I cannot tell you when it will happen now.

I am afraid you should go with web forms solution for your problem: create a web form having all functionality or load it inside an iframe. You can mix web forms and mvc in web project easily nowadays.
Left by Ilya on Jan 15, 2014 4:30 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Great wrapper. Very easy to use. Have you added support for local rendering? People like you make other developers life so much easier. Keep up the good work.
Left by David on May 04, 2014 3:18 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
ce-ar fi sa-mi beliti voi pula ?
Left by pulea in pizdea on May 08, 2014 8:54 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi,

This is a great post. I used this in order to get SSRS Reports working in my MVC application. I am strugeling to style the IFrame. Like to take those horizontal and vertical scrolls bars out and etc.

If you know of any solution to style the report then it would be really helpful.

Thanks,
Vivek
Left by Vivek Patel on Jun 13, 2014 9:33 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi,

You could take a look to http://stackoverflow.com/questions/325273/make-iframe-to-fit-100-of-containers-remaining-height. They have quite useful styling techniques for iframes.
Left by Ilya on Jun 16, 2014 10:35 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
Hi Ilya,
Thanks for this tool. Question: we have 2 drop downs on the same page as the report viewer. Selections from those 2 drop downs are used as parameters for the report. We do this with javascript. However, when the page first renders and no items are selected from the drop downs, a message is displayed saying 'The "Region" parameter is missing a value'.
How can we suppress that message until the users selects values and clicks the button?
Thanks
Left by Rance on Mar 10, 2015 2:31 PM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
hello

tool worked great when i was using ReportViewer v11.
I recently had to upgrade to ReportViewer v12.
i now am getting an iFrames not supported error?

any help appreciated.
Left by Graham on Jan 19, 2016 11:38 AM

# re: SQL Server Reporting Services Report Viewer wrapper for ASP.NET MVC has been released!
Requesting Gravatar...
I think you should update MvcReportViewer to the latest version. The latest version works well with ReportViewer 12. You can also try to find an answer to your question on the project's bug tracker. https://github.com/ilich/MvcReportViewer/issues
Left by Ilya on Jan 20, 2016 4:32 AM

Your comment:
 (will show your gravatar)


Copyright © Ilya Verbitskiy | Powered by: GeeksWithBlogs.net