Skip to content

This example contains the projects with the Document Viewer and Report Designer for ASP.NET WebForms, ASP.NET MVC, ASP.NET Core and Blazor Server. The projects show how to create an object data source, bind it to the report and restore the object data source when the Document Viewer or Report Designer loads a report from the REPX file.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/reporting-web-object-data-source

Repository files navigation

Reporting for Web - How to Use the Object Data Source in Web Reporting Applications

This example includes simple projects with report components (Document Viewer and Report Designer) for ASP.NET WebForms, ASP.NET MVC, ASP.NET Core, and Blazor Server (JavaScript-based) platforms. The project demonstrates how to create an object data source, bind it to a report, and restore the object data source when Document Viewer or Report Designer loads a report from a REPX file.

The ObjectDataSource serves as an intermediate layer between the report and the collection of data elements to which the report is bound. The advantage of ObjectDataSource is that it is serialized in the report definition file (REPX). Otherwise, if you bind the report to a collection of custom objects, the data source information cannot be serialized, and you cannot restore the data source when you load the report from the REPX file.

Assign an ObjectDataSource instance to the DataSource property of the report. The ObjectDataSource instance specifies the type, constructors, methods, and properties of a custom object that creates a collection of data items. The custom object can contain a method that populates the collection of data items at runtime or retrieves data from any external data source.

The CustomWebDocumentViewerReportResolver service in this example implements the IWebDocumentViewerReportResolver interface. The Document Viewer calls that before loading a report specified by name. The service creates a report, assigns the data source, and passes the report to the Document Viewer.

The CustomReportStorageWebExtension service loads and saves a report specified by name in the Report Designer. The service is a ReportStorageWebExtension descendant.

The CustomObjectDataSourceConstructorFilterService implements the IObjectDataSourceConstructorFilterService interface and filters the list of constructors available for the ObjectDataSource in the Report Wizard and Data Source Wizard.

The ObjectDataSourceWizardCustomTypeProvider service implements the IObjectDataSourceWizardTypeProvider interface and defines the list of data types displayed for the ObjectDataSource in the Report Wizard and Data Source Wizard.

This example also demonstrates how to map a report parameter to the parameter used to filter data retrieved from the data source.

Files to Review

ASP.NET WebForms:

ASP.NET MVC:

ASP.NET Core:

Blazor:

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

This example contains the projects with the Document Viewer and Report Designer for ASP.NET WebForms, ASP.NET MVC, ASP.NET Core and Blazor Server. The projects show how to create an object data source, bind it to the report and restore the object data source when the Document Viewer or Report Designer loads a report from the REPX file.

Topics

Resources

License

Stars

Watchers

Forks