WebDocumentViewerBuilder.Bind(String) Method

Retrieves a specified report from the report storage and binds it to the Web Document Viewer.

Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

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

Syntax

public WebDocumentViewerBuilder Bind(
    string reportUrl
)

Parameters

Type Name Description
String reportUrl

The URL of the report to bind to the Document Viewer.

Returns

Type Description
WebDocumentViewerBuilder

A WebDocumentViewerBuilder that can be used to further configure the Document Viewer.

A Document Viewer requests an appropriate CachedReportSourceWeb object to generate a document by the specified report's unique name, when required. The CachedReportSourceWeb object generates a report document caching each generated page. This consumes less memory in comparison to the report generation method used when a report instance is directly passed to the Document Viewer.

@Html.DevExpress().WebDocumentViewer("DocumentViewer").Height("1000px").Bind("MyReport")

Implement the ICachedReportSourceWebResolver interface to associate the specified report's unique name with the CachedReportSourceWeb object that possesses the corresponding report. The following code demonstrates how to register a custom ICachedReportSourceWebResolver.

using DevExpress.XtraReports.Web.WebDocumentViewer;
//...
public void ConfigureServices(IServiceCollection services) {
    //...
    services.AddSingleton<ICachedReportSourceWebResolver>(new CustomCachedReportSourceWebResolver());
}
Tip

If several Bind method calls are invoked one after another, the Document Viewer displays the report that is specified in the last method call.

Using this Bind method overload allows the Document Viewer to regenerate documents when using their interactive features after the application pool has recycled, because the initial report can always be found.

By default, the CachedReportSourceWeb object caches a report document to the MemoryDocumentStorage. You can use a file, database or a custom storage instead so that the Document Viewer can recover its document from the storage after the application pool has recycled. Utilize a file storage by calling the UseFileDocumentStorage.overloads method. To use a DbDocumentStorage or a custom storage, register your IDocumentStorageProvider object.