How to add custom data-extension for Web Report Designer in ASP.NET Core application
The Syncfusion Web Report Designer has a support to access the custom data extension.
Refer to the following documentation link to create a Report Designer sample in ASP.NET Core.
Getting Started documentation.
Please find the below steps to add the Web API DataExtension sample in our Web Report Designer sample.
Step1: Add the Web API Extension project reference to our Web Report Designer sample as shown in below snap:
Step2: Add the configuration section in AppConfig or WebConfig file as shown in below code example.
App.config
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="ReportingExtensions" type="Syncfusion.Reporting.Extensions, Syncfusion.Report.Portable" allowLocation="true" allowDefinition="Everywhere" /> </configSections> <ReportingExtensions> <DataExtension> <Extension Name="WebAPI" Assembly="Syncfusion.Reporting.DataExtensions.WebAPI" Type="Syncfusion.Reporting.DataExtensions.WebAPI.WebAPIExtension"> <Properties> <Add Key="QueryDesignerEnabled" Value="true"/> <Add Key="QueryFilterEnabled" Value="false"/> <Add Key="QueryExpressionEnabled" Value="false"/> <Add Key="QueryJoinerEnabled" Value="false"/> <Add Key="QueryColumnEdit" Value="false"/> </Properties> </Extension> </DataExtension> </ReportingExtensions> </configuration>
Step2: Set report-data-extensions property in Index.cshtml file with ViewBag as shown in below code example.
Index.schtml
<ej-report-designer id="reportdesigner1" create="controlInitialized" service-url="../Home" report-data-extensions="@ViewBag.ReportDataExtensions"> </ej-report-designer> <ej-script-manager></ej-script-manager>
HomeController.cs
public ActionResult Index() { ViewBag.ReportDataExtensions = new List<Syncfusion.JavaScript.Models.ReportDesigner.ReportDataExtensionsModule>(); var ReportDataExtension = new Syncfusion.JavaScript.Models.ReportDesigner.ReportDataExtensionsModule(); ReportDataExtension.Name = "WebAPI"; ReportDataExtension.ClassName = "WebAPIDataSource"; ReportDataExtension.ImageClass = "e-reportdesigner-datasource-webapi"; ReportDataExtension.DisplayName = "WebAPI"; ViewBag.ReportDataExtensions.Add(ReportDataExtension); return View(); }
You can download the sample from the following location.
Sample
https://www.syncfusion.com/downloads/support/directtrac/general/ze/ReportSample_core-1912445644