ActiveReports 8 > ActiveReports User Guide > Samples and Walkthroughs > Samples > Page Report > FPL Samples > Data > Page Unbound Data Sample |
The PageUnboundData sample demonstrates how to connect a page report to an unbound data source at runtime, using the DataSet provider with the LocateDataSource event. The reporting engine raises the LocateDataSource event when it needs input on the data to use.
Sample Location
Visual Basic.NET
<User Folder>\ComponentOne Samples\ActiveReports 8\Page Reports\FPL\Data\VB.NET\PageUnboundData
C#
<User Folder>\ComponentOne Samples\ActiveReports 8\Page Reports\FPL\Data\C#\PageUnboundData
Runtime Features
When you run this sample, the Invoice2.rdlx report is displayed in the Viewer control. The report displays the Invoice form with the list of products along with the product ID, quantity and price of the products.
The report connects to an unbound data source at runtime using the LocateDataSource event and the DataSet provider.
Project Details
Invoice2.rdlx
In the Report Data Source dialog, the type of the report data source is set to DataSetProvider and the ConnectionString is left blank. In the DataSet dialog, data fields used on the report are added to the DataSet on the Fields page.
This report uses the Table, TextBox, Label and Shape controls to create an Invoice layout for displaying the customer transactions. The Container control at the bottom of the report contains a label, a textbox and line control. The textbox uses the Sum function to display the sum of the values returned by the expression indicated in the Value property.
ViewerForm
This is the main form that appears when you run this sample. It uses the ActiveReports Viewer control to display the report at runtime. The code-behind the form contains the code with the LocateDataSource event that connects the Invoice2.rdlx report to unbound data and the code that populates fields for the data table.