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

WebDocumentViewerClientSideEventsBuilder.OnServerError(String) Method

Sets the name of the JavaScript function or the entire code that will handle the Web Document Viewer's OnServerError client-side event.

Namespace: DevExpress.AspNetCore.Reporting.WebDocumentViewer

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

Declaration

public WebDocumentViewerClientSideEventsBuilder OnServerError(
    string callback
)
Public Function OnServerError(
    callback As String
) As WebDocumentViewerClientSideEventsBuilder

Parameters

Name Type Description
callback String

The name of a JavaScript function or the entire JavaScript function code used to handle the OnServerError event.

Returns

Type Description
WebDocumentViewerClientSideEventsBuilder

A WebDocumentViewerClientSideEventsBuilder that can be used to further configure the Document Viewer's client-side events.

Remarks

The OnServerError event is raised on the client side each time a server-side error occurs. Handle this event to perform required actions when an Ajax request completes with an error. When implementing a handling function, use the objects passed as parameters. The first parameter passes the event sender that is the ClientDocumentViewer object. The second one is an object with the following field exposed.

  • Error
    Provides information about a server-side error.

The following code snippet demonstrates how to show an alert box when any internal server error occurs.

@{
    var documentViewer = Html.DevExpress().WebDocumentViewer("webDocumentViewer1")
        .Height("1000px")
        .Bind(Model.Report)
        .ClientSideEvents(configure => { configure.OnServerError("onError"); });;
}
@documentViewer
See Also