How to set reports parameter from Asp.net?

Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[1];
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(@"http://albatross/ReportServer$CABS");
ReportViewer1.ServerReport.ReportPath = "/rptRoomUsageSummary1";//(string)Session["rptMBRCode"],(string)Session["rptLocation"],(string)Session["rptRoom"]


ReportViewer1.ServerReport.ReportPath = "/rptReportName";

reportParameterCollection = new Microsoft.Reporting.WebForms.ReportParameter[2];

reportParameterCollection.SetValue(new Microsoft.Reporting.WebForms.ReportParameter(parameter_name,parameter_value, 6);

//Here 6 is the length of the parameter. Pass your parameter name and value.
         

//Code sample to display the report

 if (reportParameterCollection.Length > 0)
      {
        ReportViewer1.ServerReport.SetParameters(reportParameterCollection);
        ReportViewer1.EnableViewState = true;
        ReportViewer1.ServerReport.Refresh();
        ReportViewer1.ShowPrintButton = true;
      }

Ebook Download
View all
Learn
View all