Back to Devexpress

ReportDesignerClientSideEventsBuilder.OnServerError(String) Method

xtrareports-devexpress-dot-aspnetcore-dot-reporting-dot-reportdesigner-dot-reportdesignerclientsideeventsbuilder-dot-onservererror-x28-system-dot-string-x29.md

latest3.5 KB
Original Source

ReportDesignerClientSideEventsBuilder.OnServerError(String) Method

Sets the name of the JavaScript function or the entire code that will handle the Web Report Designer‘s OnServerError client-side event.

Namespace : DevExpress.AspNetCore.Reporting.ReportDesigner

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

NuGet Package : DevExpress.AspNetCore.Reporting

Declaration

csharp
public ReportDesignerClientSideEventsBuilder OnServerError(
    string callback
)
vb
Public Function OnServerError(
    callback As String
) As ReportDesignerClientSideEventsBuilder

Parameters

NameTypeDescription
callbackString

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

|

Returns

TypeDescription
ReportDesignerClientSideEventsBuilder

A ReportDesignerClientSideEventsBuilder that can be used to further configure the Report Designer 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 a Fetch 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 ClientReportDesigner 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 designer = Html.DevExpress().ReportDesigner("reportDesigner1").Height("1000px")
        .Bind(Model.Report)
        .DataSources(configureDS => { foreach (var ds in Model.DataSources) { configureDS.Add(ds.Key, ds.Value); } })
        .ClientSideEvents(configure => { configure.OnServerError("onError"); });
}
@designer
javascript
<script type="text/javascript" id="script"> 
    function onError(s, e) {
        alert("Internal Server Error occurs");
    }
</script>

See Also

Reporting Application Diagnostics

ReportDesignerClientSideEventsBuilder Class

ReportDesignerClientSideEventsBuilder Members

DevExpress.AspNetCore.Reporting.ReportDesigner Namespace