The requested page is not available for the requested platform. You are viewing the content for Default platform.

WebDocumentViewerBuilder.AutoBind(Boolean) Method

Specifies whether to bind the Web Document Viewer to an autogenerated View Model automatically.

Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

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

Declaration

public WebDocumentViewerBuilder AutoBind(
    bool autoBind
)
Public Function AutoBind(
    autoBind As Boolean
) As WebDocumentViewerBuilder

Parameters

Name Type Description
autoBind Boolean

Indicates whether to bind the Web Document Viewer to an autogenerated View Model automatically.

Returns

Type Description
WebDocumentViewerBuilder

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

Remarks

By default, AutoBind is set to true. In this mode, the Document Viewer's View Model is generated based on the values you specified for the Document Viewer Builder. Then, this View Model is used when Knockout activates the Document Viewer's binding.

Setting AutoBind to false prevents an automatic insert of an element with the Document Viewer's binding. This allows you to generate this element specifying a custom View Model for it and to activate Knockout when required, manually. To generate an element with the Document Viewer's binding, call the Document Viewer Builder's Build method. This method appends a div element containing the dxDocumentViewer binding that is set to the View Model's property that you pass as the method's parameter.

In the following code, the Document Viewer's Knockout binding is activated manually, but this binding is set to an autogenerated View Model.

@{
    var viewerRender = Html.DevExpress().DocumentViewer("DocumentViewer1").Height("1000px").AutoBind(false);
}

@viewerRender.Build("documentViewerOptions")

<script type="text/javascript">
    ko.applyBindings({ documentViewerOptions: @viewerRender });
</script>
See Also