The DataSetDataSource sample demonstrates how to connect a Page Report to an unbound data source at run time, using the DataSet provider with the LocateDataSource event. The reporting engine raises the LocateDataSource event when it needs input on the data to use.
Visual Basic.NET
C#
https://github.com/activereports/Samples18/tree/main/DataBinding/PageAndRDLX/DataSetDataSource/C#
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 run time using the LocateDataSource event and the DataSet provider.
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.
This is the main form that appears when you run this sample. It uses the ActiveReports Viewer control to display the report at run time. 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.