Specify Parameter Values
- 2 minutes to read
Specify Parameter Values in the Report Designer
Use the Parameters Panel to specify parameter values in the Visual Studio Report Designer:
Specify Parameter Values in Code
To specify a value for a report parameter in code, reference the parameter by name in the report’s Parameters collection and assign the value to the parameter’s Value property.
using System;
// ...
// Create a report instance.
XtraReport1 report = new XtraReport1();
// Reference a parameter by name in the report's Parameters
// collection and assign a value to the parameter's Value property.
report.Parameters["parameter1"].Value = 30;
Specify the parameter’s value before you generate the report’s document (call the CreateDocument() method) or invoke the report’s Print Preview.
You can also update the parameter’s value in the report’s BeforePrint event handler:
private void XtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
(sender as XtraReport1).Parameters["parameter1"].Value = 42;
}
Specify Parameter Values in a Web Reporting Application
Refer to the following topics for details:
- Specify Parameter Values in a Web Forms Reporting Application
- Specify Parameter Values in an ASP.NET MVC Reporting Application
- Specify Parameter Values in an ASP.NET Core Reporting Application
- Specify Parameter Values in a Blazor Reporting Application
- Specify Parameter Values in a Blazor Report Viewer (Native) Application
- Specify Parameter Values in an Angular Reporting Application