Skip to main content
All docs
V25.1
  • WebDocumentViewerBuilderBase<TSettings, TImpl, TModel>.Bind(TModel) Method

    Passes a View Model to create a reporting component.

    Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

    Assembly: DevExpress.AspNetCore.Reporting.v25.1.dll

    NuGet Package: DevExpress.AspNetCore.Reporting

    Declaration

    public TImpl Bind(
        TModel model
    )

    Parameters

    Name Type Description
    model TModel

    A View Model.

    Returns

    Type Description
    TImpl

    A WebDocumentViewerBuilderBase<TSettings, TImpl, TModel> that can be used in method chaining to configure the component.

    Remarks

    The application controller should use the WebDocumentViewerClientSideModelGenerator object to create a View Model. You can call the GetModel method overload to create a report model and pass it to the view.

    The advantage of this technique is that it allows you to use an asynchronous task for report creation. You can call the UseAsyncEngine method at application startup to enable asynchronous mode, and use the GetModelAsync method:

    using DevExpress.AspNetCore.Reporting.WebDocumentViewer;
    using DevExpress.XtraReports.Web.WebDocumentViewer;
    using Microsoft.AspNetCore.Mvc;
    using System.Threading.Tasks;
    // ...
        public class HomeController : Controller {        
            public async Task<IActionResult> Index([FromQuery] string reportName = "MainReport") {
                var modelGenerator = new WebDocumentViewerClientSideModelGenerator(HttpContext.RequestServices);
                var model = await modelGenerator.GetModelAsync(reportName, WebDocumentViewerController.DefaultUri);
                return View(model);
            }
        }
    
    See Also