Skip to main content
All docs
V24.1

IReportDesignerModelBuilder.ViewerUri(String) Method

Specifies a custom controller for the Document Viewer (Preview) invoked by the Web Report Designer.

Namespace: DevExpress.XtraReports.Web.ReportDesigner.Services

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

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

IReportDesignerModelBuilder ViewerUri(
    string uri
)

Parameters

Name Type Description
uri String

A string that is the route to the controller.

Returns

Type Description
IReportDesignerModelBuilder

A IReportDesignerModelBuilder that can be used to further configure the Report Designer.

Remarks

The following code example specifies custom controllers for the Web Report Designer:

using System.Collections.Generic;
using System.Net.Mime;
using DevExpress.XtraReports.Web.ReportDesigner;
using DevExpress.XtraReports.Web.ReportDesigner.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace AspNetCore.Reporting.Common.Controllers {
    [ApiController]
    [Authorize]
    [Route("api/[controller]")]
    public class ReportDesignerSetupController : ControllerBase {
        [HttpPost("[action]")]
        public object GetReportDesignerModel([FromForm] string reportUrl,
            [FromServices] IReportDesignerModelBuilder reportDesignerModel,
            [FromServices] IReportDesignerClientSideModelGenerator modelGenerator) {
            Dictionary<string, object> dataSources = new Dictionary<string, object>();
            //Fill a data source set if needed
            reportDesignerModel
                .Report(reportUrl)
                .DataSources(dataSources)
                .DesignerUri("/DXXRDAngular")
                .ViewerUri("/DXXRDVAngular")
                .QueryBuilderUri("/DXXQBAngular")
                .BuildJsonModel();
            var model = reportDesignerModel.BuildModel();
            var modelJson = modelGenerator.GetJsonModelScript(model);
            return Content(modelJson, MediaTypeNames.Application.Json);
        }
    }
}
using DevExpress.AspNetCore.Reporting.QueryBuilder;
using DevExpress.AspNetCore.Reporting.QueryBuilder.Native.Services;
using DevExpress.AspNetCore.Reporting.ReportDesigner;
using DevExpress.AspNetCore.Reporting.ReportDesigner.Native.Services;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
using DevExpress.AspNetCore.Reporting.WebDocumentViewer.Native.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace AspNetCore.Reporting.Common.Controllers {
    [Authorize]
    [Route("DXXRDVAngular")]
    public class AngularWebDocumentViewerController : WebDocumentViewerController {
        public AngularWebDocumentViewerController(IWebDocumentViewerMvcControllerService controllerService) : base(controllerService) {
        }


    }

    [Authorize]
    [Route("DXXQBAngular")]
    public class AngularQueryBuilderController : QueryBuilderController {
        public AngularQueryBuilderController(IQueryBuilderMvcControllerService controllerService) : base(controllerService) {
        }
    }


    [Route("DXXRDAngular")]
    [Authorize]
    public class AngularReportDesignerController : ReportDesignerController {
        public AngularReportDesignerController(IReportDesignerMvcControllerService controllerService) : base(controllerService) {
        }
    }
}

View Example

See Also