Asp.net-mvc – Calling SSRS Reports From asp.net MVC4 (Also sending parameter to that report)

asp.net-mvcasp.net-mvc-4reporting-servicesssrs-2008-r2

Hi all i need help regarding ssrs reporting and calling it from mvc4 application which is the major concern at this time and also i want to send parameters to the ssrs from the mvc4 code so that utilizing these inputs may return the concerned data

I did search it over an over again but did not get the exact solution which is calling ssrs reports from mvc and also sending parameters from the mvc and show data in the reports against that report
Thanks in advance

Best Answer

If you simply want to navigate to the report create the URL like Mozy showed in his answer to https://stackoverflow.com/a/1128705/1859022
if you need to create the path dynamically you could use MVCs Url.Encode.


a sample implementation in your controller could look like:

public ActionResult ShowReport()
{
    //url encode path on server
    string path = Url.Encode("/path/to/folder/");
    string url = "http://<server>/ReportServer/Pages/ReportViewer.aspx?" + path + "<ReportName>&rs:Command=Render";
    //add param
    url += "&<Param>='<Value>'";
    return new RedirectResult(url);
}

use the action in your view like this:

@Html.ActionLink("Show Report", "ShowReport");

for further mvc tutorials have a look at http://www.asp.net/mvc

Related Topic