Skip to main content

ReportDesignerClientSideModelGenerator.GetModel(String, IDictionary<String, Object>, String, String, String) Method

Generates a client-side model of the Web End-User Report Designer based on specified data.

Namespace: DevExpress.XtraReports.Web.ReportDesigner

Assembly: DevExpress.XtraReports.v24.1.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public ReportDesignerModel GetModel(
    string reportUrl,
    IDictionary<string, object> dataSources,
    string controllerUri,
    string previewControllerUri,
    string queryBuilderControllerUri
)

Parameters

Name Type Description
reportUrl String

The URL that is opened in the Report Designer when the application starts.

dataSources IDictionary<String, Object>

A dictionary of available data sources in the Report Designer for use in reports.

controllerUri String

The URI of the controller action that processes Report Designer requests.

previewControllerUri String

The URI of the controller action that processes Report Designer preview requests.

queryBuilderControllerUri String

An URI of the controller action that processes requests from the Query Builder.

Returns

Type Description
ReportDesignerModel

A client-side Report Designer model.

Remarks

Note

This method internally calls the ReportStorageWebExtension.GetData method to obtain a report from a storage with the URL passed as a parameter.

Example

The following code implements the controller action and returns the Report Designer model. For more information on Report Designer server-side configuration, refer to the following help topic: Report Designer Server-Side Configuration (ASP.NET MVC).

The GetModel method obtains a client-side model and sets the ASPxReportDesigner.AllowMDI property to false. The GetJsonModelScript method serializes the model to JSON. The model is subsequently sent to the client.

using DevExpress.Web.Mvc.Controllers;
using DevExpress.XtraReports.Web.ReportDesigner;
using System.Web.Mvc;
// ...
  public ActionResult GetReportDesignerModel(string reportUrl)
  {
      Response.AppendHeader("Access-Control-Allow-Origin", "*");

      var generator = new ReportDesignerClientSideModelGenerator();
      var model = generator.GetModel(
              reportUrl,
              // A report that the Report Designer loads when the application starts.
              GetAvailableDataSources(),
              // Data sources available in the Report Designer.
              "ReportDesigner/Invoke",
              // Controller action that processes Report Designer requests.
              "WebDocumentViewer/Invoke",
              // Controller action that processes Web Document Viewer requests.
              "QueryBuilder/Invoke"      
              // Controller action that processes Query Builder requests.
          );
      model.AllowMDI = false;
      var modelJsonScript = generator.GetJsonModelScript(model);    
      return Content(modelJsonScript, "application/json");
  }
See Also