The knockout.js library was quite popular among web developers before the appearance of angular. Despiteread more
The dialogue forms in a report are mainly needed to filter the data. As aread more
January 17, 2018
One of the novelties by FastReport .Net 2018 was the adaptation of OnlineDesigner to the .Net Core framework.
In general, the online designer has not changed. Today we will consider some of the features of its use in the ASP.Net Core project.
As you remember, you first need to build OnlineDesigner in the web designer. You will see a link to the web designer in the client section at www.fast-report.com.
In the web designer of the online designer, you should choose the components that have to be present, styles, plugins, etc. Pay attention to the "Configuration" section. Here you need to set API URLs. Choose FastReport.Web for Core:
After assembling the designer, you download the archive.
Let's create an ASP.Net Core application:
Select the Web Application template:
First of all, you need to add the FastReport.Web library to your project. You can do this with the nuget package manager. Make a right click on the root of the project in the Solution Explorer and select the NuGet Package Management:
We select the local package source in the package manager:
You need to configure it on the folder:
С:\Program Files (x86)\FastReports\FastReport.Net\Nugets. To do this, click the gear icon:
After that, you will see the FastReport packages. Install the FastReport.Web:
Let's start creating the program.
We need to put the folder WebReportDesigner from the archive which we have downloaded in wwwroot.
Let's also add two folders to wwwroot: Reports and DesignedReports.
In the first folder we will put the Simple List.frx report template and the nwind.xml database. Both files can be taken in the folder C:\Program Files (x86)\FastReports\FastReport.Net\Demos\Reports. We will save the report from OnlineDesigner to the DesignedReports folder.
Open the controller HomeController.cs. Let's add libraries to using:
In the HomeController constructor, we get the hostingEnvironment object, from which we learn the absolute path to the wwwroot folder.
Let's edit the Index method:
Let’s add one more method – the server saving method:
Note: If the application runs under Core 3.x, then keep in mind that synchronous read / write streams are disabled by default. Therefore, you need to change the code at the end of the SaveDesignedReport method:
For this web method, you need to add one more view. For the folder View-> Home, call the context menu and select Add-> New item. Next, select the MVC View Page template and the name SaveDesignedReport.
The page code is quite simple:
And now edit the view index.cshtml:
The await statement indicates the call to the asynchronous report processing method.
Now open the class Startup.cs.
In the Configure method, at the very beginning, add the line:
Now the application will use the FRCore library.
Launch our web application:
Save the report:
The message “Saved” appeared to the right. It's time to check the DesignedReports folder:
The report was successfully saved.
Well. Let's sum up. FastReport .Net 2018 has completed the global adaptation of its Web components to the ASP .Net Core framework. At the same time, the developers tried to keep the mechanism of using their components to the maximum possible, similar to their use in the ASP .Net MVC.