JS1986
JS1986

Reputation: 1950

Passing parameters to Reporting Services Programmatically

I need to pass a dynamic parameter to my reporting service.

The parameter name is PCName

The processing mode is in Remote, I was able to pass the parameter to the Report if I log on to the Reporting Server manually, but I want to pass it programagically.

Here is a copy of my ASP code.

<asp:ScriptManager id='scriptManager' runat='server' />
<rsweb:ReportViewer ID="ReportViewer1" 
                    runat="server" 
                    ProcessingMode="Remote" 
                    Font-Names="Verdana" 
                    Font-Size="8pt" 
                    InteractiveDeviceInfos="(Collection)" 
                    WaitMessageFont-Names="Verdana" 
                    WaitMessageFont-Size="14pt"


                    Width="95%" 
                    Height="99%" ShowDocumentMapButton="False" 
    ShowPromptAreaButton="False" Visible="true">

<ServerReport   ReportPath="/Services/Logon" 
                ReportServerUrl="http://reports/reportserver/" />

</rsweb:ReportViewer>

Upvotes: 1

Views: 2619

Answers (1)

Mohamed Ramadan
Mohamed Ramadan

Reputation: 803

You should create a report parameter from your code behind and pass it to the report viewer control as following

ReportParameter param = new ReportParameter("PCName", "parameter value");
this.ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { param  });
this.ReportViewer1.ServerReport.Refresh();

Upvotes: 1

Related Questions