[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]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Expand]Use Report Controls
  [Collapse]Shape Report Data
   [Expand]Filter Data
   [Expand]Group and Sort
   [Expand]Shape Data (Expression Bindings)
   [Expand]Shaping Data (Legacy Data Bindings)
   [Expand]Use Calculated Fields
   [Collapse]Use Report Parameters
     Parameters Overview
     Create Multi-Value and Cascading Report Parameters
     Request and Pass Report Parameter Values
     Create Custom Report Parameters
     Query Parameters
   Lay out Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Expand]Provide Interactivity
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Request and Pass 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.

Run an application and pass a parameter value to your web page as shown below:

Viewer.aspx?parameter1=100

You can also pass values for multiple parameters through a URL by separating them with "&". The general syntax looks as follows:

{WebPageURL}?{ParameterName1}={ParameterValue1}&{ParameterName2}={ParameterValue2}

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 Create 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:

Is this topic helpful?​​​​​​​