Back to Devexpress

DynamicListLookUpSettings.DataSource Property

dashboard-devexpress-dot-dashboardcommon-dot-dynamiclistlookupsettings.md

latest9.1 KB
Original Source

DynamicListLookUpSettings.DataSource Property

Gets or sets the data source for the dashboard parameter.

Namespace : DevExpress.DashboardCommon

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

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)]
public IDashboardDataSource DataSource { get; set; }
vb
<LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)>
<DefaultValue(Nothing)>
Public Property DataSource As IDashboardDataSource

Property Value

TypeDefaultDescription
IDashboardDataSourcenull

An object implementing the IDashboardDataSource interface that specifies the data source for the dashboard parameter.

|

Remarks

You can specify a data source as a source for dashboard parameter values. To provide access to data source values, specify the following options:

UI SettingsDescriptionAPI
Data SourceSpecifies the data source for the dashboard parameter.DataSource
Data MemberSpecifies the name of the data member with the parameter values for SQL and Entity Framework data sources.DataMember
Value MemberSpecifies the name of the data field for the parameter values.ValueMember
Display Member (optional)Specifies the name of the data field displayed in the Dashboard Parameters dialog as a value description.DisplayMember
Sort By (optional)Specifies the data member used to sort parameter values.SortByMember
Sort Order (optional)Specifies the sort order.SortOrder

Note

You cannot use an OLAP data source as the data source for a dashboard parameter.

To access the collection of existing dashboard data sources, use the Dashboard.DataSources property.

The following code snippet shows how to create a dashboard parameter with dynamic look-up values in code. Use the Dashboard.Parameters property of Dashboard to access a collection of dashboard parameters.

csharp
DynamicListLookUpSettings settings = new DynamicListLookUpSettings();
settings.DataSource = sqlDataSource;
settings.DataMember = "Categories";
settings.ValueMember = "CategoryID";
settings.DisplayMember = "CategoryName";
settings.SortOrder = DimensionSortOrder.Descending;
DashboardParameter parameter3 = new DashboardParameter("Parameter3", typeof(string), "1", "Select a category:", true, settings);
vb
Dim settings As New DynamicListLookUpSettings()
settings.DataSource = sqlDataSource
settings.DataMember = "Categories"
settings.ValueMember = "CategoryID"
settings.DisplayMember = "CategoryName"
settings.SortOrder = DimensionSortOrder.Descending
Dim parameter3 As New DashboardParameter("Parameter3", GetType(String), "1", "Select a category:", True, settings)

The following code snippets (auto-collected from DevExpress Examples) contain references to the DataSource 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.

winforms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/CS/WinFormsDashboard/ViewerForm.cs#L36

csharp
}
foreach (var parameter in e.Dashboard.Parameters.Select(p => p.LookUpSettings).OfType<DynamicListLookUpSettings>().Where(p => p.DataSource == query.DataSource && p.DataMember == query.Query.Name)) {
    parameter.DataMember = "";

web-forms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/CS/ASPxDashboard/Default.aspx.cs#L85

csharp
}
foreach (var parameter in dashboard.Parameters.Select(p => p.LookUpSettings).OfType<DynamicListLookUpSettings>().Where(p => Object.ReferenceEquals( p.DataSource, query.DataSource) && p.DataMember == query.Query.Name)) {
    parameter.DataMember = "";

winforms-dashboard-filtering-in-olap-mode/CS/Dashboard_OlapFiltering/Form1.cs#L23

csharp
DynamicListLookUpSettings settings = new DynamicListLookUpSettings();
settings.DataSource = olapDataSource;
settings.ValueMember = fieldCountryName;

winforms-dashboard-pass-dashboard-parameters-to-filter-string-in-code/CS/Dashboard_Parameters/Form1.cs#L23

csharp
DynamicListLookUpSettings settings = new DynamicListLookUpSettings();
settings.DataSource = parameterDataSource;
settings.DataMember = "Categories";

web-forms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/VB/ASPxDashboard/Default.aspx.vb#L87

vb
Next item
For Each parameter In dashboard.Parameters.Select(Function(p) p.LookUpSettings).OfType(Of DynamicListLookUpSettings)().Where(Function(p) Object.ReferenceEquals(p.DataSource, dsQuery.DataSource) AndAlso p.DataMember = dsQuery.Query.Name)
    parameter.DataMember = ""

winforms-dashboard-replace-sql-data-source-with-object-data-source-with-filtered-data/VB/WinFormsDashboard/ViewerForm.vb#L40

vb
parameter.DataMember = ""
    parameter.DataSource = ods
Next parameter

winforms-dashboard-filtering-in-olap-mode/VB/Dashboard_OlapFiltering/Form1.vb#L25

vb
Dim settings As New DynamicListLookUpSettings()
settings.DataSource = olapDataSource
settings.ValueMember = fieldCountryName

winforms-dashboard-pass-dashboard-parameters-to-filter-string-in-code/VB/Dashboard_Parameters/Form1.vb#L24

vb
Dim settings As New DynamicListLookUpSettings()
settings.DataSource = parameterDataSource
settings.DataMember = "Categories"

See Also

Create a Dashboard Parameter in the WinForms Designer

DynamicListLookUpSettings Class

DynamicListLookUpSettings Members

DevExpress.DashboardCommon Namespace