Skip to main content
All docs

QueryBuilderClientSideEventsBuilder.SaveQueryRequested(String) Method

Specifies the JavaScript function that handles the Web Query Builder‘s SaveQueryRequested client-side event.

Namespace: DevExpress.AspNetCore.Reporting.QueryBuilder

Assembly: DevExpress.AspNetCore.Reporting.v24.1.dll

NuGet Package: DevExpress.AspNetCore.Reporting


public QueryBuilderClientSideEventsBuilder SaveQueryRequested(
    string callback


Name Type Description
callback String

The name of a JavaScript function used to handle the SaveQueryRequested event.


Type Description

A reference to the QueryBuilderClientSideEventsBuilder instance after the event handler is specified.


The SaveQueryRequested event allows you to get the query object, constructed in the Web Query Builder. This event is raised when the user clicks Save in the Web Query Builder toolbar.

Use the GetSaveQueryModel method of the client-side Query Builder object to obtain the query model. The following code gets the query model and sends it to the server:

@model DevExpress.XtraReports.Web.QueryBuilder.QueryBuilderModel

<link href="~/css/querybuilder.part.bundle.css" rel="stylesheet" />
<script src="~/js/querybuilder.part.bundle.js"></script>

    function SaveQueryRequested() {
        var saveQueryModel = webQueryBuilder.GetSaveQueryModel();
            url: "/Home/SaveQuery",
            type: "POST",
            data: saveQueryModel,
            success: function(result) {
                window.location = "/";
    .ClientSideEvents( x => {

On the server side, use the IQueryBuilderInputSerializer service to restore the QueryBuilderInput object and retrieve the query:

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using DevExpress.XtraReports.Web.QueryBuilder.Services;
using System.ComponentModel.DataAnnotations;
using DevExpress.DataAccess.Web.QueryBuilder;
using DevExpress.DataAccess.Sql;
// ...
  public async Task<IActionResult> SaveQuery(
  [FromServices] IQueryBuilderInputSerializer queryBuilderInputSerializer,
  [FromForm] DevExpress.DataAccess.Web.QueryBuilder.DataContracts.SaveQueryRequest saveQueryRequest)
          var queryBuilderInput = queryBuilderInputSerializer.DeserializeSaveQueryRequest(saveQueryRequest);
          // Get the query constructed in the Query Builder.
          SelectQuery resultingQuery = queryBuilderInput.ResultQuery;
          string sql = queryBuilderInput.SelectStatement;
          return new RedirectToActionResult("Index", "Home", null);
      catch (Exception ex)
          var validationException = ex.InnerException as DevExpress.DataAccess.Sql.ValidationException;
          return Problem(validationException?.Message ?? ex.Message);
See Also