Skip to main content

Register Predefined Data Sources

  • 2 minutes to read

This document describes how to provide data sources to the Web Report Designer. These data sources are available for all reports.

To do this, create the data sources at runtime and add them to the ASPxReportDesigner.DataSources collection.


The complete sample project How to Provide Data Sources for the Web End-User Report Designer is available in the DevExpress Examples repository.

using System;

namespace WebApplication1
    public partial class Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

            DevExpress.DataAccess.Sql.SqlDataSource sqlDataSource = GenerateSqlDataSource();
            DevExpress.DataAccess.ObjectBinding.ObjectDataSource objDataSource = GenerateObjectDataSource();
            DevExpress.DataAccess.EntityFramework.EFDataSource efDataSource = GenerateEFDataSource();
            DevExpress.DataAccess.Excel.ExcelDataSource excelDataSource = GenerateExcelDataSource();
            DevExpress.DataAccess.Json.JsonDataSource jsonDataSource = GenerateJsonDataSource();

            ASPxReportDesigner1.DataSources.Add(sqlDataSource.Name, sqlDataSource);
            ASPxReportDesigner1.DataSources.Add(objDataSource.Name, objDataSource);
            ASPxReportDesigner1.DataSources.Add(efDataSource.Name, efDataSource);
            ASPxReportDesigner1.DataSources.Add(excelDataSource.Name, excelDataSource);
            ASPxReportDesigner1.DataSources.Add(jsonDataSource.Name, jsonDataSource);

    // ...


The Json Data Source uses the open source Newtonsoft.Json library to provide JSON data at runtime. Install the Newtonsoft.Json package if your application does not reference this library.

In the End User Designer, when the user adds a data source to a report, a clone of the data source object is assigned to the report’s DataSource property. This is required to properly serialize the data source settings along with the report layout data when the report is saved.

To add data sources, click the Add button in the Field List panel:


See Also