Skip to main content
A newer version of this page is available. .

DxReportDesigner.DataSources Property

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

Namespace: DevExpress.Blazor.Reporting

Assembly: DevExpress.Blazor.Reporting.v20.2.dll

NuGet Package: DevExpress.Blazor.Reporting

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