In an effort to simplify a project that used Telerik’s Reporting Engine, I wanted to create a single View that listed the available reports and a single View to hold the HTML Report Viewer. In the middle of the project a new requirement was added; you know how that goes. Some reports needed to be able to have querystring parameters come from a related View. This is how I did it. Behold the magic.

 

First I built my View to list the reports. Each report had a link like this:

 

@Html.ActionLink("Click Me", "Report", 
    new { title = "Report Title", path = "Namespace.Path.To.Report" }, 
    new { target = "_blank", @class = "btn btn-primary" })

 

You can get the Namespace path from the code behind file of the report.

 

Set up an ActionResult like this:

 

public ActionResult Report(string path, string title)

{

    ViewBag.ReportPath = path + ", ProjectNS";

    ViewBag.Title = title;

    return View();

}

 

ProjectNS should be your root Namespace. 

 

Read More