Passing hidden variable using a report viewer control.

  • To all,

    I have sql 2005 reporting services working fine on webserver A.

    On web server A I have a report that gets all the logins for a certain company, a company id in a variable in the report.

    I connect to web server A from web server B using a Report Viewer Control and it works.

    What I want to do, is in my aspx.cs file with the report viewer control, I want to pass to the report a hidden id, such as company id for the report variable. I am using a stored procedure in the report to populate it.

    Would someone please show me how to do this?

    Thanks in advance

    Gary

  • This is VB.net but should be pretty easy for you to translate

    rptTest is the report viewer

    Dim parameters As ReportParameter() = New ReportParameter(2) {}

    parameters(0) = New ReportParameter("param1", Trim("value1"), False)

    parameters(1) = New ReportParameter("param2", Trim("value2"), False)

    parameters(2) = New ReportParameter("param3", Trim("value3"), False)

    rptTest.ServerReport.SetParameters(parameters)

    rptTest.ServerReport.Refresh()

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply