Back to Devexpress

XtraReport.ParametersRequestBeforeShow Event

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-f92982a7.md

latest4.3 KB
Original Source

XtraReport.ParametersRequestBeforeShow Event

Occurs before the Parameters panel is displayed in the Print Preview.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public event EventHandler<ParametersRequestEventArgs> ParametersRequestBeforeShow
vb
Public Event ParametersRequestBeforeShow As EventHandler(Of ParametersRequestEventArgs)

Event Data

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

PropertyDescription
ParametersInformationProvides access to information about the requested parameters.

Remarks

Handle the ParametersRequestBeforeShow event in the following cases:

  1. To modify parameter properties (for example, initialize default values) before the parameter is displayed in the Parameters panel.
  2. To replace a parameter editor with a custom editor (WinForms only).

The ParametersRequestEventArgs.ParametersInformation collection stores information about all report parameters. Each element of this collection is a ParameterInfo object. Use the object’s Parameter property to access a parameter and its properties. Use the object’s Editor property to access and modify a parameter’s default editor. Refer to the following topic for more information: Implement a Custom Parameter Editor in WinForms Applications.

Note

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

Example

The following code sample specifies a parameter’s default value in a ParametersRequestBeforeShow event handler:

csharp
private void XtraReport1_ParametersRequestBeforeShow(object sender, DevExpress.XtraReports.Parameters.ParametersRequestEventArgs e) {
    foreach (var paramInfo in e.ParametersInformation) {
        if (paramInfo.Parameter.Name == "company") {
            paramInfo.Parameter.Value = "ALFKI";
            break;
        }
    }
}
vb
Private Sub XtraReport1_ParametersRequestBeforeShow(sender As Object, e As DevExpress.XtraReports.Parameters.ParametersRequestEventArgs) Handles MyBase.ParametersRequestBeforeShow
    For Each paramInfo In e.ParametersInformation
        If paramInfo.Parameter.Name = "company" Then
            paramInfo.Parameter.Value = "ALFKI"
            Exit For
        End If
    Next paramInfo
End Sub

See Also

Use Report Parameters

XtraReport Class

XtraReport Members

DevExpress.XtraReports.UI Namespace