Skip to main content

XtraReport.ParametersRequestValueChanged Event

Occurs when parameter values change in the Parameters user interface.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public event EventHandler<ParametersRequestValueChangedEventArgs> ParametersRequestValueChanged

Event Data

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

Property Description
ChangedParameterInfo Contains information about the parameter whose value changed.
ErrorText Gets or sets the error message.
ParametersInformation Contains information about the requested parameters.

Remarks

The event is applicable on for Reporting for WinForms and Native Report Viewer for Blazor.

Refer to the following topic for more information on how to validate parameter values in the Blazor Report Viewer: Validate Parameter Values in Native Report Viewer.

Limitations

  • The ParametersRequestValueChanged is not raised in JavaScript-Based Reporting Components for Web.

  • The ParametersRequestValueChanged event is not raised for subreports. You can handle this event for a main report and use the ParametersRequestValueChangedEventArgs class to access the subreports’ parameters in the event handler.

Example

The example validates report parameters and restores the previous parameter value if the validation fails (if the parameter value is greater than 10 or less than 0).

Handle the report’s XtraReport.ParametersRequestSubmit and XtraReport.ParametersRequestValueChanged events to perform validation.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Parameters;
// ...

namespace CancelSubmitParameters {
    public partial class XtraReport1 : XtraReport {
        int parameter;
        public XtraReport1() {
            InitializeComponent();
        }

        private void XtraReport1_ParametersRequestSubmit(object sender, 
            ParametersRequestEventArgs e) {
            if ((int)e.ParametersInformation[0].Parameter.Value > 10 || 
                (int)e.ParametersInformation[0].Parameter.Value < 0) {
                e.ParametersInformation[0].Parameter.Value = parameter;
                e.ParametersInformation[0].Editor.Text = parameter.ToString();
            }
        }

        private void XtraReport1_ParametersRequestValueChanged(object sender, 
            ParametersRequestValueChangedEventArgs e) {
            parameter = (int)e.ChangedParameterInfo.Parameter.Value;
        }

    }
}
using System;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...

namespace CancelSubmitParameters {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {
            XtraReport1 report = new XtraReport1();
            ReportPrintTool printTool = new ReportPrintTool(report);
            printTool.ShowPreviewDialog();
        }

    }
}
See Also