DynamicListLookUpSettings.DataSource Property

Specifies the data source for the storage that contains the report parameter's predefined values.

Namespace: DevExpress.XtraReports.Parameters

Assembly: DevExpress.Printing.v20.2.Core.dll

Declaration

public override object DataSource { get; set; }
Public Overrides Property DataSource As Object

Property Value

Type Description
Object

A Object value.

Examples

The code sample below illustrates how to create a date parameter with a dynamic list of predefined values and filter report data by this parameter.

using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.Expressions;
// ...
DevExpress.DataAccess.ObjectBinding.ObjectDataSource objectDataSource = new DevExpress.DataAccess.ObjectBinding.ObjectDataSource() {
    Name = "ObjectDataSource1",
    DataSource = CreateLookups(),
};
public XtraReport CreateReportWithDateParameterDynamicList() {
    XtraReport1 report = new XtraReport1();

    Parameter myDateParameter = new Parameter();
    myDateParameter.Name = "myDateParameter";
    // Set the Visible property to true to request the parameter value from users.
    // Set this property to false to apply the parameter's value that is specified in code.
    myDateParameter.Visible = true;
    myDateParameter.Type = typeof(System.DateTime);
    // Specify the storage for the parameter's predefined values
    DynamicListLookUpSettings lookupSettings = new DynamicListLookUpSettings();
    lookupSettings.DataSource = objectDataSource;
    lookupSettings.ValueMember = "Value";
    lookupSettings.DisplayMember = "Description";
    myDateParameter.ValueSourceSettings = lookupSettings;
    report.Parameters.Add(myDateParameter);
    // Filter report data by the specified parameter.
    report.FilterString = "GetDate([OrderDate]) >= ?myDateParameter";

    return report;
}
static List<LookUpValue> CreateLookups() {
    return new List<LookUpValue>() {
        new LookUpValue(new DateTime(2019, 01, 01), "January 1, 2019"),
        new LookUpValue(new DateTime(2019, 02, 01), "February 1, 2019"),
    };
}
See Also