Back to Devexpress

Parameter.ValueSourceSettings Property

corelibraries-devexpress-dot-xtrareports-dot-parameters-dot-parameter-75cd2eae.md

latest6.5 KB
Original Source

Parameter.ValueSourceSettings Property

Gets or sets settings used to generate predefined values for a report parameter.

Namespace : DevExpress.XtraReports.Parameters

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
[DefaultValue(null)]
public virtual ValueSourceSettings ValueSourceSettings { get; set; }
vb
<DefaultValue(Nothing)>
Public Overridable Property ValueSourceSettings As ValueSourceSettings

Property Value

TypeDefaultDescription
ValueSourceSettingsnull

Settings used to generate predefined values for a report parameter.

|

Remarks

Set the ValueSourceSettings property to one of the following class instances:

Example

The code sample below demonstrates how to do the following:

  1. Create a multi-value report parameter.
  2. Configure a DynamicListLookUpSettings class instance to load predefined values for this parameter from a database.
  3. Select all predefined parameter values as defaults.

csharp
using DevExpress.XtraReports.Parameters;
// ...
// Create a parameter and set up its properties. Set the
// parameter's MultiValue property to true to make it multi-value.
var parameter1 = new Parameter() {
    Name = "categories",
    Description = "Categories: ",
    Type = typeof(System.Int32),
    MultiValue = true
};

// Create a DynamicListLookUpSettings class instance and
// configure its properties to retrieve the parameter's predefined values
// from the report's data source.
var lookupSettings = new DynamicListLookUpSettings() {
    DataSource = report.DataSource,
    DataMember = "Categories",
    DisplayMember = "CategoryName",
    ValueMember = "CategoryId"
};

// Assign the setting to the parameter's LookUpSettings property.
parameter1.LookUpSettings = lookupSettings;

// Enable the parameter's SelectAllValues property to use
// all predefined values as defaults.
parameter1.SelectAllValues = true;
vb
Imports DevExpress.XtraReports.Parameters
' ...
' Create a parameter and set up its properties. Set the
' parameter's MultiValue property to true to make it multi-value.
Dim parameter1 = New Parameter() With {
    .Name = "categories",
    .Description = "Categories: ",
    .Type = GetType(System.Int32),
    .MultiValue = True
}

' Create a DynamicListLookUpSettings class instance and
' configure its properties to retrieve the parameter's predefined values
' from the report's data source.
Dim lookupSettings = New DynamicListLookUpSettings() With {
    .DataSource = report.DataSource,
    .DataMember = "Categories",
    .DisplayMember = "CategoryName",
    .ValueMember = "CategoryId"
}

' Assign the setting to the parameter's LookUpSettings property.
parameter1.LookUpSettings = lookupSettings

' Enable the parameter's SelectAllValues property to use
' all predefined values as defaults.
parameter1.SelectAllValues = True

The following code snippets (auto-collected from DevExpress Examples) contain references to the ValueSourceSettings 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-daterange/CS/Program.cs#L41

csharp
// Assign the settings to the parameter's ValueSourceSettings property.
dateRangeParam.ValueSourceSettings = dateRangeSettings;

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

csharp
// Assign data storage settings to the parameter's ValueSourceSettings property.
param.ValueSourceSettings = lookupSettings;

reporting-winforms-parameter-daterange/VB/Program.vb#L33

vb
' Assign the settings to the parameter's ValueSourceSettings property.
dateRangeParam.ValueSourceSettings = dateRangeSettings

reporting-winforms-parameter-static-list/VB/Form1.vb#L59

vb
' Assign the specified settings to the parameter's ValueSourceSettings property.
dateParameter.ValueSourceSettings = lookupSettings

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

vb
' Assign data storage settings to the parameter's ValueSourceSettings property.
param.ValueSourceSettings = lookupSettings

See Also

Parameter Class

Parameter Members

DevExpress.XtraReports.Parameters Namespace