locked
Passing Parameters to Remote Reporting Service RRS feed

  • Question

  • User1665250412 posted

    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:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <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="/Statistics" 
                        ReportServerUrl="http://reports.ar.net/reportserver/" />
        
        </rsweb:ReportViewer>



    Saturday, July 21, 2012 10:45 PM

Answers

  • User306743125 posted

    try something like this in your codebehind...

     string Reportpath = "yor report path";
     ReportViewer1.ServerReport.ReportPath = Reportpath;
     this.ReportViewer1.DataBind();
     Microsoft.Reporting.WebForms.ReportParameter[] reportParameter = new Microsoft.Reporting.WebForms.ReportParameter[1];
     string strPCName = "the pc name";
     reportParameter[0] = new Microsoft.Reporting.WebForms.ReportParameter("PCName", strPCName);
     this.ReportViewer1.ServerReport.SetParameters(reportParameter);
     this.ReportViewer1.ServerReport.Refresh();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 22, 2012 7:21 AM

All replies