Skip to main content
All docs
V25.1
  • IReportDesignerClientSideModelGenerator Interface

    Generates a client-side model of the Web End-User Report Designer in ASP.NET Core applications.

    Namespace: DevExpress.XtraReports.Web.ReportDesigner

    Assembly: DevExpress.XtraReports.v25.1.Web.dll

    NuGet Package: DevExpress.Web.Reporting.Common

    Declaration

    public interface IReportDesignerClientSideModelGenerator

    Remarks

    The following code generates a client-side model that includes a data source. The data source becomes available for the end-user in the Web Report Designer:

    using System.Collections.Generic;
    using DevExpress.DataAccess.Sql;
    using DevExpress.AspNetCore.Reporting.ReportDesigner;
    using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services;
    using DevExpress.XtraReports.Web.ReportDesigner;
    
    public class ReportDesignerController : ReportDesignerApiControllerBase {
        public class CustomReportDesignerController : ReportDesignerController {
            public CustomReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) {
            }
    
            [HttpPost("[action]")]
            public IActionResult GetDesignerModel([FromForm]string reportUrl, [FromServices] IReportDesignerClientSideModelGenerator modelGenerator) {
                var dataSources = new Dictionary<string, object>();
                var 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();
                dataSources.Add("Northwind", ds);
    
                var model = modelGenerator.GetModel(reportUrl, dataSources, ReportDesignerController.DefaultUri, WebDocumentViewerController.DefaultUri, QueryBuilderController.DefaultUri);
                return DesignerModel(model);
            }
        }
    

    For more information review the following article: Report Designer Server-Side Configuration (ASP.NET Core).

    See Also