locked
filter report in report viewer RRS feed

  • Question

  • User-54013672 posted

     can someone help me how to filter report in report viewer in between two dates in asp.net using textbox visual studio 2010?

    Friday, October 28, 2016 10:11 AM

All replies

  • User-2057865890 posted

    Hi Remil,

    filter report in report viewer in between two dates in asp.net using textbox

    When using ReportViewer, you could use ReportParameter to create parameter.

    Code snippets

     // Create the report parameter  
    ReportParameter[] rptParams = new ReportParameter[]
    {
       new ReportParameter("fromDate",txtFrom.Text),
       new ReportParameter("toDate",txtTo.Text)
    };
    
    // Set the report parameters for the report 
    rptViewer.LocalReport.SetParameters(rptParams); 

    reference:

    Using the WebForms ReportViewer Control

    Best Regards,

    Chris

    Friday, October 28, 2016 3:19 PM
  • User-1479952219 posted

    ReportParameter[] parameters = new ReportParameter[x+1];
    parameters[0] = new ReportParameter("name1", value1);
    ...
    parameters[x] = new ReportParameter("namex", valuex);
    this.reportViewer1.LocalReport.SetParameters(parameters);

    Tuesday, December 6, 2016 1:32 PM