Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Collapse]Creating Reports in Visual Studio
  [Expand]Adding a Report to Your .NET Application
  [Expand]Getting Started with DevExpress Reporting
  [Collapse]Detailed Guide to DevExpress Reporting
   [Expand]Storing and Distributing Reports
   [Collapse]Providing Data to Reports
    [Expand]Data Binding Overview
    [Collapse]Tutorials and Code Examples
      Bind a Report to a Database
      Bind a Report to a Stored Procedure
      Bind a Report to an MDB Database (Runtime Sample)
      Bind a Report to a Microsoft SQL Server Database (Runtime Sample)
      Register a Custom Schema Provider for a Synonym Database
      Bind a Report to an Object Data Source
      Bind a Report to a Collection that Implements the ITypedList Interface (Runtime Sample)
      Bind a Report to an Array List (Runtime Sample)
      Bind a Report to a List Object at Design Time and Provide Data at Runtime
      Bind a Report to an Entity Framework Data Source
      Bind a Report to an Entity Framework Stored Procedure
      Filtering an Entity Framework Data Source
      Bind a Report to a CSV File
      Bind a Report to a CSV File (Runtime Sample)
      Bind a Report to an Excel Workbook
      Bind a Report to an Excel Workbook (Runtime Sample)
      Bind a Report to an XML File
      Bind a Report to an XML File (Runtime Sample)
      Bind a Report to a Data Source Schema
      Bind a Report to Multiple Data Sources
      Bind a Report to Multiple Data Tables
   [Expand]Shaping Report Data
   [Expand]Report Navigation, Interactivity and Appearance
   [Expand]Reporting API
  [Expand]Detailed Guide to Visual Studio Report Designer
 [Expand]Creating End-User Reporting Applications
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Bind a Report to an Array List (Runtime Sample)

This tutorial demonstrates how to bind a report to data represented in the ArrayList object.

To bind a report to an array list, do the following.

  1. Start Microsoft Visual Studio 2010, 2012, 2013, 2015 or 2017 and create a new application under any of the supported platforms, or open an existing one.

  2. Add a new blank report to it.

  3. Declare a public AddBoundLabel method in the XtraReport1 class. Please refer to the Binding Report Controls to Data topic for more information on binding report controls.

  4. Now, declare a class that represents an individual record. The code below declares a class with the ID, Name and Age public properties. These properties will be data source fields.

  5. Once the record class has been declared, the data source object can be filled with records. This example will use an System.Collections.ArrayList as the report's data source. So, there is no need to create a custom object implementing the IList, ITypedList or IBindingList interfaces.

    The code below fills an System.Collections.ArrayList with records and assigns it to the report's XtraReportBase.DataSource property.

    Now the report is bound to the runtime created data. Let's then add three XRLabel objects to the Detail band of the report and bind them to different data fields.

  6. Note

    For the web application to work properly, create a report and assign it to the Document Viewer when the web page is initialized or loaded.

Executing the above code will bind a report to the data created at runtime. The resulting report is shown in the image below.

Expanded See Also

How would you rate this topic?​​​​​​​