Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Collapse]Creating Reports in Visual Studio
  [Expand]Adding a Report to Your .NET Application
  [Expand]Getting Started with DevExpress Reporting
  [Collapse]Detailed Guide to DevExpress Reporting
   [Expand]Storing and Distributing Reports
   [Expand]Providing Data to Reports
   [Collapse]Shaping Report Data
    [Expand]Data Filtering
    [Expand]Grouping and Sorting
    [Expand]Shaping Data using Expression Bindings
    [Expand]Shaping Data using Legacy Data Bindings
    [Expand]Using Calculated Fields
    [Collapse]Using Report Parameters
      Parameters Overview
      Creating Multi-Value and Cascading Report Parameters
      Requesting and Passing Report Parameter Values
      Creating Custom Report Parameters
      Passing Parameter Values to a Data Source Query
   [Expand]Report Navigation, Interactivity and Appearance
   [Expand]Reporting API
  [Expand]Detailed Guide to Visual Studio Report Designer
 [Expand]Creating End-User Reporting Applications
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Requesting and Passing Report Parameter Values

This document illustrates how to assign the default and custom values to a report's parameters and describes the editors that are used to request these values in a Print Preview:

Expanded Requesting Parameter Values in a Print Preview

The Parameter.Value property specifies the parameter's value. This value must correspond to the parameter's value type the Parameter.Type property defines.

A parameter's value is not requested from end-users and is automatically passed to the report when the parameter's Parameter.Visible property is set to false. When a report has at least one visible parameter, a Print Preview provides a user interface for submitting parameter values.

When loading a Print Preview, a report's document is not created by default unless values for all visible parameters are submitted. To create report documents without requesting parameter values (and using their default values instead), set the report's XtraReport.RequestParameters property to false.

Expanded Passing Parameter Values at Runtime

You can specify parameter values in code. The following code illustrates how to assign a value to a report parameter at runtime:

You can provide values to a multi-value report parameter in code by constructing a required type value array and assigning this array to the Parameter.Value property:

You can update a parameter's value either in a report's XRControl.BeforePrint event handler or in a method that generates a report document (such as PrintTool.ShowPreviewDialog or PrintTool.ShowRibbonPreviewDialog).

Note

We recommend that you do not assign these property values using parameters when declaring custom public properties in XtraReport class descendants. The application that opens this file must contain a declaration of this report class to restore these property values from a serialized report definition.


Passing Parameter Values to a Web Report Through a URL

In web reporting applications, you can pass a parameter value to a report using a URL.

Add the Web Document Viewer to your Web page and handle the Page_Load event. In the event handler, create a new report instance, find the required parameter in the XtraReport.Parameters collection and obtain the parameter value using the Request.QueryString property.

Expanded Standard Parameter Editors

The Parameter.Type property determines which values a parameter can accept. The corresponding value editors are created automatically for the following standard parameter types:

  • String
  • Date
  • Number
    • 16-bit integer
    • 32-bit integer
    • 64-bit integer
    • floating point
    • double-precision floating point
    • decimal
  • Boolean
  • GUID (Globally Unique Identifier)

The following image illustrates the standard editors for parameter values in a WinForms application:

Expanded Look-Up Parameter Editors

You can list a parameter's values in a lookup editor:

Assign Multiple Values to a Parameter

A parameter can also be allowed to accept multiple values (by enabling its Parameter.MultiValue property).

When creating cascading parameters, the list of values available for one parameter is filtered based on another parameter's current value. See Creating Multi-Value and Cascading Report Parameters for more information.

Expanded Custom Parameter Editors

For parameters of both standard and custom types, you can implement custom editors. The Parameters panel displays these editors when a report is being loaded in a Print Preview.

Custom editor implementation for parameters varies depending on your application's platform:

How would you rate this topic?​​​​​​​