Skip to main content
A newer version of this page is available. .

XtraReport.ParametersRequestBeforeShow Event

Occurs before displaying the Parameters panel in a Print Prevew.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

public event EventHandler<ParametersRequestEventArgs> ParametersRequestBeforeShow

Event Data

The ParametersRequestBeforeShow event's data class is ParametersRequestEventArgs. The following properties provide information specific to this event:

Property Description
ParametersInformation Provides access to information about the requested parameters.

Remarks

Use the ParametersRequestBeforeShow event in Windows Forms applications to request the parameter values on the client using custom editors.

To access the information about a parameter, use the ParametersRequestEventArgs.ParametersInformation property. It returns the ParameterInfo that provides the ParameterInfo.Parameter and ParameterInfo.Editor properties.

To assign a default value to a parameter, use the Parameter.Value property.

Example

This example illustrates how to change the standard editor displayed in Print Preview for a report parameter with a custom one.

Tip

Print Preview displays default value editors according to report parameter types (their Parameter.Type property values).

A custom editor specified in this example is used only for demonstration purposes, because a LookUpEdit is automatically assigned to parameters for which the ReportParameter.LookUpValues property is specified.

Handle the XtraReport.ParametersRequestBeforeShow event and assign a custom editor to the ParameterInfo.Editor property of the ParameterInfo object stored in the ParametersRequestEventArgs.ParametersInformation collection to provide a custom report parameter editor in a WinForms application.

using System;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Parameters;
// ...

private void XtraReport1_ParametersRequestBeforeShow(object sender, ParametersRequestEventArgs e) {
    CategoriesDataSet dataSet = new CategoriesDataSet();
    CategoriesDataSetTableAdapters.CategoriesTableAdapter adapter = 
        new CategoriesDataSetTableAdapters.CategoriesTableAdapter();
    adapter.Fill(dataSet.Categories);

    foreach (ParameterInfo info in e.ParametersInformation) {
        if (info.Parameter.Name == "parameter1") {
            LookUpEdit lookUpEdit = new LookUpEdit();
            lookUpEdit.Properties.DataSource = dataSet.Categories;
            lookUpEdit.Properties.DisplayMember = "CategoryName";
            lookUpEdit.Properties.ValueMember = "CategoryID";
            lookUpEdit.Properties.Columns.Add(new 
                LookUpColumnInfo("CategoryName", 0, "Category Name"));
            info.Editor = lookUpEdit;
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ParametersRequestBeforeShow event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also