Several reports in the same object WebReport - Working with tabs
Web Reports direction actively develops in FastReport.Net. A new feature - bookmarks, you can create a bookmark to a web report toolbar. These tabs allow you to open other reports in the same window. Such a decision may be convenient to display a series of reports similar subjects or reports related by the context. It looks like this:
Tabs are presented in the form of buttons. By selecting a tab, we run the report in the same window. Now there is no need to display each report in individual object WebReport. This will help to save space on the page and to avoid congestion of the site.
Let's look at the implementation of this function in the example. I used the MVC web project.
Add FastReport libraries to the project:
They can be found in the folder FastReport.Net application.
Create in the controller Home: instances of report objects, data source, tabs. In general, all the logic here.
Declare the libraries:
For Index method write the following code:
There is another interesting property:
If it is set to true, the tabs will have an "X" to close the tab.
This option may be useful in interactive reports, where tabs will be dynamically created and contain detailed reports. If a report is not needed, you can close the tab. Then, if necessary, it will be possible again to generate its tab.
Above we have looked at how to create a tab, send them reports. We used:
As parameters we pass the report object and the name of the tab. However, you can do one parameter:
Pass a report object. This tab name will be generated automatically. This will be the serial number of a tab.
It is possible to pass the already built report to bookmark of a Web report:
Here, we pass: report, name for the tab and the property that indicates whether the report is to be pre-built. You can upload a file of already prepared report into the report object, and the last parameter specify as true. Then the report will be loaded from the specified file fpx.
It might look like this:
I showed how to keep the prepared report to a file, and then download it and use it in a web report tab.
Go to the view. In the folder Views-> Home open the file Index.cshtml.
All page code consists of four lines:
In the last line of the report output. Home controller sends a report to the page.
Add scripts for the web report in the initialization of view _Layout.cshtml (in Views-> Shared folder):
Edit the Web.config, which is located in the Views folder
Add the namespace:
Edit the Web.config, which is located in the project root. Add the handler:
Undoubtedly, the new feature of the addition of tabs in the Web report will be useful and in demand. Features of web reports is gradually expanding. It seems that in the near future, web reports nothing will not yield to the desktop reports.