none
Weird loop behavior when I pass parameter to reportviewer RRS feed

  • Question

  • Hi there,

    When I pass a parameter to the reportviewer control , then the page never display the report and keep in an infinite loop. What could causing this? There is no error anywhere..

    Below is my code:

     

    // Set the processing mode for the ReportViewer to Remote
              ReportViewer1.ProcessingMode = ProcessingMode.Remote;

              ServerReport serverReport = ReportViewer1.ServerReport;

              // Set the report server URL and report path
              serverReport.ReportServerUrl =
                  new Uri( "http://server/reportserver" );
              serverReport.ReportPath =
                  "/ReportProject1/Report1";

              // Create the sales order number report parameter
              ReportParameter parameter = new ReportParameter();
              parameter.Name = "ReportParameter1";
              parameter.Values.Add( "6" );
              parameter.Visible = true;

              // Set the report parameters for the report
              ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { parameter } );

     

    Thank you,


    Joe
    Thursday, May 12, 2011 4:48 PM

Answers

  • I figure out the issue.

     

    You can't call SetParameters method in Page_load, this will cause an infinite loop. instead you need to call SetParameters in Page_init.

     

    More details:

    http://blogs.msdn.com/b/brianhartman/archive/2010/03/21/reports-never-stop-loading-with-vs-2010.aspx

     

    Cheers,


    Joe
    • Marked as answer by Joe.C Thursday, May 12, 2011 5:21 PM
    Thursday, May 12, 2011 5:20 PM