Back to Devexpress

Document Viewer Client-Side Events in ASP.NET Core Application

xtrareports-400272-web-reporting-asp-net-core-reporting-document-viewer-in-asp-net-applications-customization-document-viewers-client-side-events.md

latest2.0 KB
Original Source

Document Viewer Client-Side Events in ASP.NET Core Application

  • Mar 13, 2024
  • 2 minutes to read

The Web Document Viewer control provides an advanced client-side API in addition to the comprehensive server-side object model. This enables web applications based on this control to function more efficiently by combining server-side and client-side processing.

The WebDocumentViewerClientSideEventsBuilder class exposes methods that allow you to pass client-side events’ handlers. To access this class instance, use the WebDocumentViewerBuilder.ClientSideEvents method.

@{
    var documentViewer = Html.DevExpress().WebDocumentViewer("webDocumentViewer1")
        .Height("1000px")
        .ClientSideEvents(configure => {
        configure.CustomizeMenuActions("customizeMenuAction");
        })
        .Bind("TestReport");
}
@documentViewer
javascript
<script type="text/javascript" id="script">
    function customizeMenuAction(s, e) {
        // Get the "Export" action and hide it.
        var exportAction = e.GetById(DevExpress.Reporting.Viewer.ActionId.ExportTo);
        if (exportAction)
            exportAction.visible = false;
    }
</script>

The Document Viewer Client-Side events allow you to perform the following actions:

  • Customize Document Viewer Elements and Actions

  • Customize Parameter Editors

  • Manage Report Parameters

  • Respond to Parameter Reset and Submitting

  • Respond to Document Loading

  • Manage Interactivity

  • Localize the Document Viewer

  • Respond to Server-Side Errors

  • Initialize the Document Viewer