I need to use different a Subreport datasource as the information comes from different tables in my database, but I want to do this using code and not through the wizard.
How can I do to accomplish this, or another option I suggest a package?
Thank you.
1 Answer, 1 is accepted
0
Steve
Telerik team
answered on 24 Nov 2009, 04:23 PM
Hello Franko,
Delivering data for a child subreport can be accomplished in three ways:
Using report parameters and filters (done through the report designer)
Using the NeedDataSource event of the SubReport item
Using the NeedDataSource event of the Child report.
From your scarce explanation, it would seem that you aim for #2. This method is appropriate in the case child report is shared between more than one master reports and thus show different data depending on the context. The child report DataSource should be null, thus signaling the reporting engine to raise NeedDataSource event. The event handler usually resides in the Master report definition class. The handler normally looks as the next code snippet: