Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxReportDesigner.DataSources Property

Provides access to the data sources available in the Report Designer.

Namespace: DevExpress.Blazor.Reporting

Assembly: DevExpress.Blazor.Reporting.v24.2.JSBasedControls.dll

NuGet Package: DevExpress.Blazor.Reporting.JSBasedControls

#Declaration

[Parameter]
public Dictionary<string, object> DataSources { get; set; }

#Property Value

Type Description
Dictionary<String, Object>

A dictionary that contains data sources and their names.

#Remarks

Use this method to set up multiple data sources for a report. Multiple data sources allows you to assign an individual data source to a subreport, detail report, Chart, Sparkline or PivotGrid report controls.

The following code adds a SqlDataSource to a collection of data sources available in the Report Designer.

@page "/"
@using DevExpress.DataAccess.Sql


<DxReportDesigner ReportName="MyTableReport" Height="1000px" Width="100%" AllowMDI="false" DataSources="@myDataSources"/>

@code {
    Dictionary<string, object> myDataSources = new Dictionary<string, object>();

    protected override void OnInitialized()
    {
        AddDataSource();
    }


    void AddDataSource()
    {
        SqlDataSource ds = new SqlDataSource("NWindConnectionString");
        // Create a SQL query to access the Products data table.
        SelectQuery query = SelectQueryFluentBuilder.AddTable("Products").SelectAllColumnsFromTable().Build("Products");

        ds.Queries.Add(query);
        ds.RebuildResultSchema();
        myDataSources.Add("Northwind", ds);
    }
}
See Also