Back to Devexpress

DocumentOperationService Class

xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-0a2f57a6.md

latest4.4 KB
Original Source

DocumentOperationService Class

Allows you to perform a custom operation initiated on the client.

Namespace : DevExpress.XtraReports.Web.WebDocumentViewer

Assembly : DevExpress.XtraReports.v25.2.Web.dll

NuGet Package : DevExpress.Web.Reporting.Common

Declaration

csharp
public class DocumentOperationService
vb
Public Class DocumentOperationService

Remarks

You can call the following method on the client side to initiate a custom operation:

ASP.NET Web Forms & MVCASP.NET Core & JS Frameworks
ASPxClientWebDocumentViewer.PerformCustomDocumentOperationJSReportViewer.PerformCustomDocumentOperation

On the server, you should create a DocumentOperationService class descendant, and override its DocumentOperationService.CanPerformOperation method to define which operations are permitted and the DocumentOperationService.PerformOperation method to perform the operation.

You should register the DocumentOperationService class descendant (the CustomDocumentOperationService class in the following code snippets) at application startup:

ASP.NET Core

csharp
using DevExpress.XtraReports.Web.WebDocumentViewer;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.AddScoped<DocumentOperationService, CustomDocumentOperationService>();

var app = builder.Build();

ASP.NET MVC

csharp
using DevExpress.XtraReports.Web.WebDocumentViewer;
// ...
public class MvcApplication : System.Web.HttpApplication {
    protected void Application_Start() {
        // ...
        DefaultWebDocumentViewerContainer.Register<DocumentOperationService, Services.CustomDocumentOperationService>();
        // ...
        MVCxWebDocumentViewer.StaticInitialize();
        // ...
    }
    // ...
}

ASP.NET Web Forms

csharp
using DevExpress.XtraReports.Web.WebDocumentViewer;
// ...
void Application_Start(object sender, EventArgs e) 
{
..//.
DefaultWebDocumentViewerContainer.Register<DocumentOperationService, CustomDocumentOperationService>();
//...
ASPxWebDocumentViewer.StaticInitialize();
}

For a code sample, review the following example:

View Example: Reporting for Web - How to Email a Report from the Document Viewer

Inheritance

Object DocumentOperationService

See Also

DocumentOperationService Members

Register Services in the Document Viewer (ASP.NET Web Forms)

Register Services in the Document Viewer (ASP.NET MVC)

Register Services in the Document Viewer (ASP.NET Core)

DevExpress.XtraReports.Web.WebDocumentViewer Namespace