Back to Devexpress

DynamicListLookUpSettings.DisplayMember Property

corelibraries-devexpress-dot-xtrareports-dot-parameters-dot-dynamiclistlookupsettings-fd580d86.md

latest6.2 KB
Original Source

DynamicListLookUpSettings.DisplayMember Property

Specifies the data member for the storage that contains the report parameter’s display name.

Namespace : DevExpress.XtraReports.Parameters

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[DefaultValue("")]
public string DisplayMember { get; set; }
vb
<DefaultValue("")>
Public Property DisplayMember As String

Property Value

TypeDefaultDescription
StringString.Empty

A String value.

|

Example

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.

csharp
using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
// ...
DevExpress.DataAccess.ObjectBinding.ObjectDataSource objectDataSource = 
    new DevExpress.DataAccess.ObjectBinding.ObjectDataSource()
{
    Name = "ObjectDataSource1",
    DataSource = CreateLookups(),
};
public XtraReport CreateReportWithDateParameterDynamicList()
{
    XtraReport report = new XtraReport();
    Parameter myDateParameter = new Parameter();
    myDateParameter.Name = "myDateParameter";
    // Sets the Visible property to true to request the parameter value from users.
    // Sets this property to false to apply the parameter's value that is specified in code.
    myDateParameter.Visible = true;
    myDateParameter.Type = typeof(System.DateTime);
    // Specifies 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);
    // Filters 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"),
    };
}
vb
Imports DevExpress.XtraReports.Parameters
Imports DevExpress.XtraReports.UI
Imports System
Imports System.Collections.Generic
' ...
Private objectDataSource As New DevExpress.DataAccess.ObjectBinding.ObjectDataSource() With {.Name = "ObjectDataSource1", .DataSource = CreateLookups()}
Public Function CreateReportWithDateParameterDynamicList() As XtraReport
    Dim report As New XtraReport()
    Dim myDateParameter As New Parameter()
    myDateParameter.Name = "myDateParameter"
    ' Sets the Visible property to true to request the parameter value from users.
    ' Sets this property to false to apply the parameter's value that is specified in code.
    myDateParameter.Visible = True
    myDateParameter.Type = GetType(Date)
    ' Specifies the storage for the parameter's predefined values
    Dim lookupSettings As New DynamicListLookUpSettings()
    lookupSettings.DataSource = objectDataSource
    lookupSettings.ValueMember = "Value"
    lookupSettings.DisplayMember = "Description"
    myDateParameter.ValueSourceSettings = lookupSettings
    report.Parameters.Add(myDateParameter)
    ' Filters report data by the specified parameter.
    report.FilterString = "GetDate([OrderDate]) >= ?myDateParameter"

    Return report
End Function
Private Shared Function CreateLookups() As List(Of LookUpValue)
    Return New List(Of LookUpValue)() From {
        New LookUpValue(New Date(2019, 1, 1), "January 1, 2019"),
        New LookUpValue(New Date(2019, 2, 1), "February 1, 2019")
    }
End Function

The following code snippets (auto-collected from DevExpress Examples) contain references to the DisplayMember property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-winforms-parameter-multivalue/CS/Program.cs#L36

csharp
lookupSettings.DataMember = "Categories";
lookupSettings.DisplayMember = "CategoryName";
lookupSettings.ValueMember = "CategoryId";

reporting-winforms-parameter-dynamic-list/CS/Form1.cs#L37

csharp
lookupSettings.ValueMember = "Name";
lookupSettings.DisplayMember = "Position";

reporting-winforms-parameter-dynamic-list/VB/Form1.vb#L36

vb
lookupSettings.ValueMember = "Name"
lookupSettings.DisplayMember = "Position"

See Also

DynamicListLookUpSettings Class

DynamicListLookUpSettings Members

DevExpress.XtraReports.Parameters Namespace