Geeks With Blogs
Ilya Verbitskiy Thoughts and links about computer programming

I am glad to see that people started to use my small library. I released new version few days ago.

I added a possibility to download SSRS reports in MS Word, MS Excel, PDF or Image format directly from your controller. You can do that using Report extension method Controller class. The method always returns an instance of FileStreamResult class:

  1. FileStreamResult Report(ReportFormat reportFormat, string reportPath)
  2. FileStreamResult Report(ReportFormat reportFormat, string reportPath, object reportParameters)
  3. FileStreamResult Report(ReportFormat reportFormat, string reportPath, string reportServerUrl, string username = null, string password = null, object reportParameters = null)

Where reportFormat might be ReportFormat.Excel, ReportFormat.Word, ReportFormat.PDF or ReportFormat.Image.

The following code allows user to download the report in MS Excel format.

public ActionResult DownloadExcel()
{
    return this.Report(
        ReportFormat.Excel,
        "/Reports/TestReport",
        new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345 });
}

 

UPDATE: I released version 0.2.1 few minutes ago. The latest version has the bug-fix for the issue when it was not possible to use the helper in cluster environment when StateServer or SQLServer session state containers had been used. Bug Report.

Posted on Monday, November 25, 2013 6:35 PM SQL Server , ASP.NET , Projects | Back to top


Comments on this post: MvcReportViewer v.0.2.0 is available!

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi Ilya,

I am happy too. The MvcReportViewer helper works like a charm.
Thank you so much Ilya.
Left by Hayu Rahiza on Nov 28, 2013 4:36 AM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi Ilya,

Congrats on new version. Does it support RDLC too? If yes, how?


Thanks.
Left by Afshar Mohebbi on Dec 01, 2013 12:29 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi,

Unfortunately it support only SSRS Server Side rendering. MvcReportViewer is just a wrapper around Report Viewer Web Control. Local rendering implementation will require implementing own control. It is too much work for now. I may think about it in the future.
Left by Ilya on Dec 01, 2013 1:32 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hello-
I was able to get your product up and running easily. I was just wondering if there is a way that I could specify the report that a user picks from a select control? Do I need to have the MvcReportViewer for each report?

Thanks
Left by Joe on Dec 02, 2013 10:55 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi Joe,

I think you can add report name/path to your Model's property, and then pass it to ReportPath method. You will have just one helper call on the page.
Left by Ilya on Dec 03, 2013 12:01 AM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi Ilya,

I wrote an tutorial about using RDLC in ASP.NET MVC. It's here http://goo.gl/oGtnJ9 [Persian]. Maybe interesting for you or others.

Cheers,
Left by Afshar Mohebbi on Dec 04, 2013 2:16 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
Hi Ilya, I'm new to asp.net mvc but I followed your tutorial to the letter and I have a very basic view for test purposes, and it consists of the following

using System.Web.Mvc;
using System.Web.Mvc.Html;

@{
ViewBag.Title = "Tutorial";
}

<h2>Tutorial</h2>

@Html.MvcReportViewer(
"/Tutorial2/Categories",
new { Parameter1 = "Condiments"},
new { Height = 900, Width = 900, style = "border: none" })

I end up with the following error....

Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper<dynamic>' does not contain a definition for 'MvcReportViewer' and no extension method 'MvcReportViewer' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<dynamic>' could be found (are you missing a using directive or an assembly reference?)

Can you let me know where I'm going wrong.
Thanks.
Left by Joe Davies on Dec 08, 2013 12:21 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
I am working on creating SSRS reports and have found the reportmanager a bit rubbish.
I found this while looking for an alternate solution. Never used ASP.NET before, but managed to get the example working.
However I noticed the report behaves differently then when in report manager. In particular the expand toggle, for some reason when that is clicked it increases the width and throws the report out of format. (stretches icons, width bigger then footer bar etc)
It also reloads the report as opposed to in the report manager.
Is there anyway to get around this?
Left by Jon on Jan 15, 2014 2:28 PM

# re: MvcReportViewer v.0.2.0 is available!
Requesting Gravatar...
This is standard ASP.NET Web Forms behavior and Report Viewer web control. You cannot change it. I would recommend you to play with it settings. I am planning to release wrapper for the control's settings soon. You can change the directly in MvcReportViewer.aspx web page for the time being.

It would be nice if Microsoft implemented JavaScript/AJAX SSRS library in the future.
Left by Ilya on Jan 15, 2014 4:27 PM

Your comment:
 (will show your gravatar)


Copyright © Ilya Verbitskiy | Powered by: GeeksWithBlogs.net