RemoteDocumentSource.ParametersRequestBeforeShow Event
Occurs before displaying the Parameters panel in a Print Prevew.
Namespace: DevExpress.ReportServer.Printing
Assembly: DevExpress.Printing.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
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
When you handle the ParametersRequestBeforeShow
event and use the LookUpHelper class to populate a list of dynamic parameter values, call the Fill
or FillAsync
methods of the parameter data source before you call the LookUpHelper methods. Otherwise, the list of dynamic parameter values will be empty.
The following code snippet sets a value to a parameter if the value is contained in the dynamic list populated with values retrieved from the SqlDataSource:
using System.Linq;
using DevExpress.Data.Browsing;
using DevExpress.DataAccess.Sql;
using DevExpress.XtraReports.Parameters;
int targetValue = 2;
private void XtraReport1_ParametersRequestBeforeShow(object sender, DevExpress.XtraReports.Parameters.ParametersRequestEventArgs e) {
Parameter param1 = this.Parameters["parameter1"];
(((DynamicListLookUpSettings)param1.ValueSourceSettings).DataSource as SqlDataSource).Fill();
var valueSourceSettings = param1.ValueSourceSettings;
var dataContext = ((IServiceProvider)sender).GetService(typeof(DataContext)) as DataContext;
var lookupValues = LookUpHelper.GetLookUpValues(valueSourceSettings, dataContext);
if (lookupValues.Any(x => (int)x.Value == targetValue))
param1.Value = targetValue;
}