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

WebDocumentViewerExceptionHandler.GetDocumentCreationExceptionMessage(DocumentCreationException) Method

Enables you to handle errors related to the document creation process.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

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

Declaration

public virtual string GetDocumentCreationExceptionMessage(
    DocumentCreationException ex
)
Public Overridable Function GetDocumentCreationExceptionMessage(
    ex As DocumentCreationException
) As String

Parameters

Name Type Description
ex DocumentCreationException

An exception that occurs on the server side.

Returns

Type Description
String

A string to show in a browser when an error occurs.

Remarks

The GetDocumentCreationExceptionMessage method is called whenever an error occurs while the document creation is in process (for instance, errors in the BeforePrint or AfterPrint events of a report or specific control).

The code snippet below demonstrates how to create a descendant from the WebDocumentViewerExceptionHandler class and override the GetDocumentCreationExceptionMessage method to return a custom message.

using DevExpress.XtraReports.Web.WebDocumentViewer;

public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
    public override string GetDocumentCreationExceptionMessage(DocumentCreationException ex) {
        return "An exception occured while document creation.";
    }
}

To register the implemented exception handler, use the static DefaultWebDocumentViewerContainer.Register method at the application's startup as shown below:

void Application_Start(object sender, EventArgs e) {
    // ...
    DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
      Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();
}

See the following topics for more information:

See Also