SSRS report won't launch if multiple parameters in URL

I am trying to pass parameters to my SSRS report from an .NET application.

I have 3 parameters to pass: instanceID, EL and OL.

In my code-behind, I have codes as below:

        string params = Session["instanceID"].ToString() + "&EL=unhide&OL=unhide";
        string script = "<SCRIPT LANGUAGE='JavaScript'> ";
        script += "OpenLink1(" + params + ");";
        script += "</SCRIPT>";
        Page.RegisterStartupScript("ClientScript", script);

My javascript code is as below:

function OpenLink1(params ) {
    var str = "http://server/ReportServer/Pages/ReportViewer.aspx?%2f<path>%2f<report name>%2<report name>&rs:Command=Render&instanceID=" + params;

    window.open(str, "List", "scrollbars=yes,resizable=yes,width=800,height=600");
    return false;
}

No matter what I do, the report just won't launch (pop up).

The EL and OL parameters are supposed to hide tables in the SSRS report.

e.g. =IIF(Parameters!EL.Value = "hide", false, true)

If I remove these 2 parameters from the report and take away the parameter in the URL in code behind, the SSRS report launches without any problems.

What confuses me is that if I directly enter the URL in the browser, the report works fine - which lead me to believe that something to do with my coding and passing the parameters is wrong?

Any ideas?!

Answers


The issue is in the javascript that you're generating in your code behind. You need to put single quotes around the params variable when you're creating your function call in the generated javascript.

    script += "OpenLink1('" + params + "');";

Need Your Help

Modeless JDialog needs to be visible on top of parent

java swing jdialog

My application offers the ability to launch a long-running task. When this occurs a modeless JDialog is spawned showing the progress of the task. I specifically make the dialog modeless to allow ...

Cookie Problem with ASP.NET / ASP.NET MVC2

asp.net asp.net-mvc-2

new Version of Firefox and IE8 seem to use one windows process. We have a multi-tenancy web application which gets testet by our support team. they have different cases open at the same time which

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.