This example demonstrates how to dynamically create a DevExpress report based on the Grid View extension's data and layout. The resulting report maintains all sorting, grouping, and filtering settings applied to the grid. The example code exports this report to a PDF file, but you can also insert the resulting report into another report.
Follow the steps below to create a report based on the Grid View extension's data:
- Use session state to pass Grid View's layout settings to the controller.
- Create an instance of the XtraReport class.
- Bind the instance to the Grid View's data source.
- Based on the Grid layout, create bands and add them to the report.
- Create report controls and add them to the bands.
- Index.cshtml (VB: Index.vbhtml)
- _GridViewPartial.cshtml (VB: _GridViewPartial.vbhtml)
- HomeController.cs (VB: HomeController.vb)
- ReportHelperMVC.cs (VB: ReportHelperMVC.vb)
- MVCxGridViewState.cs (VB: MVCxGridViewState.vb)
(you will be redirected to DevExpress.com to submit your response)