ActiveReports 9 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Section Report > Data > IList Binding |
The IList Binding sample uses CollectionBase class, with implementation of IList interface to create a ProductCollection class which gets populated from the Products table of the NWind database. The created ProductCollection is used as a database for binding data to the DataGridView control.The data from ProductCollection class gets displayed using the DataSource property of DataGridView control. On clicking the Generate Report button, the ProductCollection class is again used to display the data of the generated report in a Viewer control. Similarly, you can display a report by binding to the DataSource property of a report.
Data from ProductCollection class displayed in DataGridView control
Generated report displayed in Viewer control
Sample Location
Visual Basic.NET
<User Folder>\GrapeCity Samples\ActiveReports 9\Section Reports\Data\IListBinding\VB.NET
C#
<User Folder>\GrapeCity Samples\ActiveReports 9\Section Reports\Data\IListBinding\C#
Runtime Features
When you run this sample, DataGridView, which is a standard Windows Forms control displays the custom collection. To display a report with the bound custom collection, click the Generate Report button.
Note: To run this sample, you must have access to the Nwind.mdb. A copy is located at [User Documents folder]\GrapeCity Samples\ActiveReports 9\Data. If you are unable to access the data files in the sample, create the Data folder and place all the data files to this folder, or change the reference path to the data files within the folder according to your environment. |
Project Details
The IList Binding sample consists of two projects: IListBinding and IListBinding.DataLayer.
IListBinding Project
BindIListToDataGridSample
IlistReportSample report
The report uses the ReportHeader, GroupHeader1 and Detail sections for the report output.
ReportHeader section
GroupHeader1 section
The GroupHeader1 section contains nine Label controls that define the layout of the report data.
ViewerForm
IListBinding.DataLayer project
DataProvider Class
Implements the connection to the data base.
Product Class
Defines custom collection class.