Back to Devexpress

ReportDesignerClientSideEventsBuilder.ReportSaving(String) Method

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

latest3.5 KB
Original Source

ReportDesignerClientSideEventsBuilder.ReportSaving(String) Method

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

Namespace : DevExpress.AspNetCore.Reporting.ReportDesigner

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

NuGet Package : DevExpress.AspNetCore.Reporting

Declaration

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

Parameters

NameTypeDescription
callbackString

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

|

Returns

TypeDescription
ReportDesignerClientSideEventsBuilder

A ReportDesignerClientSideEventsBuilder that can be used to further configure the Report Designer Client Side Events.

|

Remarks

The ReportSaving event enables you to perform required actions before a report is saved to a server-side report storage of the Web Report Designer. 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 structure.

  • Url
    The URL of the report currently being processed.

  • Report
    The report currently being processed.

  • Cancel
    Specifies whether to cancel saving the report.

The code sample below prohibits the user from saving a report with a specific URL.

@{
    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.ReportSaving("reportSaving"); });
}
@designer
javascript
<script type="text/javascript" id="script"> 
    function reportSaving(s, e) {
        if (e.Url.toLowerCase().includes("table"))
            e.Cancel = true;
    }
</script>

See Also

ReportDesignerClientSideEventsBuilder Class

ReportDesignerClientSideEventsBuilder Members

DevExpress.AspNetCore.Reporting.ReportDesigner Namespace