[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Design.Designer.LocateDataSource

LocateDataSource Event

Occurs when a data source is needed for the report. This event enables dynamic data source resolution.

Namespace: GrapeCity.ActiveReports.Design
Assembly: MESCIUS.ActiveReports.Design.Win.dll
Syntax
public event LocateDataSourceEventHandler LocateDataSource
Returns
Type Description
LocateDataSourceEventHandler Occurs when a data source is needed for the report. This event enables dynamic data source resolution.
Remarks

This event is triggered when the report requires a data source that has not been predefined or needs to be resolved at runtime. It allows for the dynamic provision of data sources based on the report's requirements or user input.

Event handlers can use this opportunity to present data source selection dialogs, perform custom data source configuration, or apply logic to determine the appropriate data source for the current context.

Examples

Utilize the specified event to supply data necessary for the preview functionality of page reports. This ensures that the report previews are populated with the latest data.

designer.LocateDataSource += (sender, args) => {
	var dataSourceName = args.DataSet.Query.DataSourceName;
	var dataSource = ((PageReport)designer.Report).Report.DataSources.First(x => x.Name == dataSourceName);
	if(dataSource.ConnectionProperties.DataProvider == "OBJECT")
	{
	    args.Data = new[] { new { CustomerName = "Gc Inc." } };
	}
};