title: passing parameter to report viewer
body: <p>I want to pass a parameter to my report view. I have a drop down list with values from database and a button for displaying the report after selecting an item from the drop down list.</p>
  
  <p>here is the code I wrote for adding the parameter</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      RenderReport();
  }
  
  protected void RenderReport()
  {
      try
      {
          ServerReport serverReport = ReportViewer1.ServerReport;
          ReportViewer1.ProcessingMode = ProcessingMode.Remote;
          try
          {
              serverReport.ReportServerUrl = new Uri("http://hedinaily-pc/Reports_HEDI");
          }
          catch (Exception ex)
          {
              Logger.Error(ex.Message, "");
          }
          serverReport.ReportPath = "~/Diagrammes/PresenceTotale.rdlc";
          ReportParameter employe = new ReportParameter();
          employe.Name = "Employe";
          employe.Values.Add(DropDownList1.SelectedValue);
          ReportViewer1.ServerReport.SetParameters( new ReportParameter[] { employe });
          ReportViewer1.Visible = true;               
      }
  
      catch (Exception ex)
      {
          Logger.Error(ex.Message, "");
  
      }
  
  }
  </code></pre>
  
  <p>Here is the data set of my report</p>
  
  <p><img src="https://i.stack.imgur.com/cCaZ3.png" alt="enter image description here"></p>
  
  <p>When I check my log file I find this error :</p>
  
  <pre><code>The attempt to connect to the report server failed.  Check your connection information and that the report server is a compatible version.
  </code></pre>
  
  <p>Can anyone tell me where doe's this error come from. I spent hours searching on google I found  this <a href="http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/530ed56d-7c84-4d13-8998-80a8bf142197/" rel="nofollow noreferrer">LINK</a> but I couldn't resolve it.</p>