Hi, if I have a subreport which has the same fields as the master report that accepts 3 parameters but a different final parameter for the stored proc, can I access the main reports ReportParameters in a seperate Needdatasource event for the subreport, and then change the final parameter to whatever I want ?
5 Answers, 1 is accepted
0
Hi Pete,
Every report has a NeedDataSource event. When this report is used for a subreport, this event can be invoked in the report itself or in the master report:
All the best,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Every report has a NeedDataSource event. When this report is used for a subreport, this event can be invoked in the report itself or in the master report:
- Using the NeedDataSource event of the SubReport item. This method is appropriate in the case child report is shared between more than one master reports. The child report DataSource should be null, thus signaling the reporting engine to raise NeedDataSource event. Most probably the event handler will reside in the Master report definition class. The handler normally looks as the next code snippet:
Telerik.Reporting.Processing.SubReport subReportItem = sender as Telerik.Reporting.Processing.SubReport;
ParentObj master = (ParentObj)subReportItem.DataObject.RawData;
subReportItem.InnerReport.DataSource = master.ChildObj;
- Using the NeedDataSource event for the Child report. Again the child report DataSource property should be null. The handler looks like:
Telerik.Reporting.Processing.Report report= sender as Telerik.Reporting.Processing.Report;
Telerik.Reporting.Processing.SubReport subReportItem = report.Parent as Telerik.Reporting.Processing.SubReport;
ParentObj master = (ParentObj)subReportItem.DataObject.RawData;
report.DataSource = master.ChildObj;
All the best,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Pete
Top achievements
Rank 1
answered on 22 May 2009, 07:28 AM
Thanks a lot Steve, I'll give this a go and let you know.
Pete.
Pete.
0

Pete
Top achievements
Rank 1
answered on 22 May 2009, 08:16 AM
Hi Steve, firstly thanks again for the swift response, but I still can't get this to display the subreport with errors. I've used subreports many time before but never where I need to access the master reports reportparameters to fill the subreport from a stored proc, can you post a quick example showing a basic master report with a subreport showing this parameters problem on the Adventureworks database ?
Thanks in advance,
Pete.
Thanks in advance,
Pete.
0
Accepted
Hello Pete,
I've used the example from this KB article to show you how to achieve this - modified project is attached.
Regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I've used the example from this KB article to show you how to achieve this - modified project is attached.
Regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Pete
Top achievements
Rank 1
answered on 22 May 2009, 10:18 AM
Thanks a lot for all your help Steve, this is exactly what I needed.
Pete.
Pete.