Reports Module in ASP.NET Applications
- 3 min to read
The Reports functionality in Web Sites is rather limited. It is implied that the ASP.NET Web application provides a ready-to-use Reports collection. An end-user does not have to create or customize reports, but only preview, print or download them. This topic explains features provided the eXpressApp Framework's Reports module.
The ASP.NET Reports module adds references to the DevExpress.ExpressApp.Reports.v18.2 and DevExpress.ExpressApp.Reports.Web.v18.2 assemblies.
You can add this module to the ASP.NET application project. To do this, invoke the Application Designer and drag ReportsASPNETModule from the Toolbox to the Modules panel. Alternatively, you can add this module to your ASP.NET module. For this purpose, invoke the Module Designer and drag ReportsASPNETModule from the Toolbox to the RequiredModules panel. Note that in this instance, you will need to manually add reporting templates to the application project. The easiest way to do this is to add the ReportsASPNETModule module to the application project via the Application Designer, and then remove it. This will automatically add all the required templates.
Do not forget to rebuild your solution after making changes in a Designer.
To access the reports shipped with an ASP.NET application, run the Web application project, navigate to the Report tab and click the Reports item. This will display the Reports List View:
To preview a report, click a report in the Reports List View. A Preview window will be invoked. This Preview window contains a Detail View with a single View Item. This Item is displayed by a panel that contains the ReportViewer control and two ReportToolbars, at the top and bottom. The Report Viewer shows a report. The Report Toolbar provides end-user capabilities that are common to Preview windows. For instance; saving, searching, printing and so on.
The display of the Preview window is managed by the PreviewInReportViewerAction. This Action is executed when clicking a report in the Reports List View (see ListView.ProcessSelectedItem). You can customize this Action's settings in code. To do this, access the DevExpress.ExpressApp.Reports.Web.ReportsController in which it is contained. In the Application Model, this Action is defined via the corresponding IModelAction node.
In addition to the PreviewInReportViewerAction, the ASP.NET Reports Module contains Actions that allow you to preview a report in a specific format. These Actions are not activated, by default. To learn how to use them, refer to the Format-Specific Preview Actions in ASP.NET Applications topic.
You can also display a report from a custom Controller via the ReportServiceController's ShowPreview method. To do this, use the following code:
Here, Object is a report implementing the IReportData interface.
You can show a report for a Detail View's current object, or a List View's selected object(s). For this purpose, use the Inplace Reporting feature provided by the Reports module.