WebDocumentViewerBuilder.Bind(WebDocumentViewerModel) Method
Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer
Assembly: DevExpress.AspNetCore.Reporting.v20.2.dll
NuGet Package: DevExpress.AspNetCore.Reporting
Declaration
Parameters
Name | Type | Description |
---|---|---|
model | WebDocumentViewerModel | A View Model. |
Returns
Type | Description |
---|---|
WebDocumentViewerBuilder | A WebDocumentViewerBuilder object for use in method chaining. |
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