Articles in this section

How to set parameter to Report Viewer in code behind in UWP?

UWP Report Viewer has support to programmatically set values to the ReportParameters in the report. Use the SetParameters API in the Report Viewer to provide the parameter values for rendering reports.   

C#

 
this.ReportViewer.ReportLoaded += ReportViewer_ReportLoaded;
 
private void ReportViewer_ReportLoaded(object sender, System.EventArgs e)
{
   List<ReportParameter> parameters = new List<ReportParameter>();
   ReportParameter param = new ReportParameter();
   param = new ReportParameter();
   param.Labels.Add("Road Bikes");
   param.Values.Add("2");
   param.Name = "ProductSubcategory";
   parameters.Add(param);
 
   param = new ReportParameter();
   param.Values.Add(DateTime.Parse("2003-1-1").ToString());
   param.Name = "StartDate";
   parameters.Add(param);
 
   param = new ReportParameter();
   param.Values.Add(DateTime.Parse("2003-12-31").ToString());
   param.Name = "EndDate";
   parameters.Add(param);
 
   this.ReportViewer.SetParameters(parameters);
}

 

Sample Link:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/UWP_ReportViewer-873799844.zip

Conclusion

I hope you enjoyed learning about how to set parameter to Report Viewer in code behind.

You can refer to our UWP Report Viewer feature tour page to know about its other groundbreaking feature representations.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied