New to Telerik Reporting? Download free 30-day trial

Using HTML5 MVC Report Viewer and Binding the Report with Data

Environment

Product Progress® Telerik® Reporting
Report Viewer HtmlReportViewer
Technology MVC

Description

In the MVC architectures, data can be transferred between views and controllers via model. A frequently asked question is how to use the modified data object for reports displayed by the HTML5 Report Viewer or its wrappers.

In general, the HTML5 Report Viewer and Reporting REST Service use a client-server architecture, for which the project with the HTML5 Report Viewer appears as a client for the Reporting REST Service, even if the service is added in the same project as the viewer.

The HTML5 Report Viewer sends only short JSON serialized string messages to the Reporting REST Service. The messages include details what report and resources to be processed and rendered on the server, and then delivered to the client by the service. See the article Telerik Report Viewer and Telerik Reporting REST Service for more details.

Solution

The MVC application allows users to modify and save data on the server. Once data is on the server, reports can retrieve it via data source component like SqlDataSource, WebServiceDataSource, etc.

General information:

The purpose of data source components on designing reports is to let you specify how the data to be retrieved in a declarative manner. When a report is processed, the Reporting engine uses the meta information from data source components how to retrieve the data and creates the needed data objects on its own.

Other scenarios requiring you to create or modify reports at run-time based on data are covered in the How to Implement a Custom Report Source Resolver article.

Demo

The attached demo project illustrates the scenario. The data source is a text file that is updated by the MVC application. When data is saved back in the text file, it can be pulled by the report requested in preview by the HTML5 Viewer hosted in the MVC application.

Download the final MVC application.

See Also

In this article