Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DocumentOperationService Class

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

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

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

NuGet Package: DevExpress.Web.Reporting.Common

#Declaration

public class DocumentOperationService

#Remarks

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

ASP.NET Web Forms & MVC ASP.NET Core & JS Frameworks
ASPxClientWebDocumentViewer.PerformCustomDocumentOperation JSReportViewer.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
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
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
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