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

LookUpHelper Class

Contains methods that allow you to access parameter look-up values.

Namespace: DevExpress.XtraReports.Parameters

Assembly: DevExpress.Printing.v22.1.Core.dll

NuGet Packages: DevExpress.Printing.Core, DevExpress.Win.Dashboard.Design

Declaration

public static class LookUpHelper

Remarks

Use the LookUpHelper class to access look-up values for report parameters with predifined static and dynamic values.

Example

The following code example demonstrates how to use the GetLookUpValues method of the LookUpHelper class to access look-up values of a multi-value report parameter. The example also shows how to display the descriptions of the selected parameter values in the report’s XRLabel control.

using DevExpress.Data.Browsing;
using DevExpress.XtraReports.Parameters;
using System;
// ...
private void XtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    var valueSourceSettings = this.Parameters["param1"].ValueSourceSettings;
    var dataContext = (sender as IServiceProvider).GetService(typeof(DataContext)) as DataContext;

    var lookupValues = LookUpHelper.GetLookUpValues(valueSourceSettings, dataContext);
    var selectedValues = this.Parameters["param1"].Value as Int32[];

    var text = "";

    int step = 0;
    for (var j = 0; j < lookupValues.Count; j++) {
        if (Array.IndexOf(selectedValues, Convert.ToInt32(lookupValues[j].Value)) > -1) {
            step += 1;
            if (step == selectedValues.Length) {
                text += lookupValues[j].Description;
            } else {
                text += lookupValues[j].Description + ", ";
            }
        }
    }

    xrLabel1.Text = text;
}

Inheritance

Object
LookUpHelper
See Also