Reggie Gardner

I currently have a report with 2 subreports. At runtime I set the report's data source to a DataSet. I also set the data source for the 2 subreports to the same DataSet. No data appears to be getting to the subreports.

First preview the TopEmployees report and initialization of it's DataSource, Filters and ReportParameters properties;

Then look how the master report (ProductLineSales) drives the TopEmployees through subreport's Parameters property.

2. Using NeedDataSource event handler.

In Master report opened in report designer select the Subreport item and create a NeedDataSource event handler. In this event handler we are initializing the sub report's DataSource property. We can use command parameters to filter the data:

In already mentioned Product Line Sales Report example you can preview chart1_NeedDataSource method of ProductLineSales report where we initialized the chat's data source in same fashion.

3. Using ItemDataBinding event handler.

Create Slave report and connect its DataSource through SqlDataAdapter with command parameter as demonstrated here and expose the parameter through public property;

In Master report opened in report designer select the Subreport item and create a ItemDataBinding event handler. In this event handler we are initializing the sub report's command parameter.

Please preview attached 107491B sample solution.

About using one DataSet object as data source for master and sub reports. Probably the empty reports in your case are result of not filled DataSet object. Please preview attached 107491A sample solution where three-level hierarchy is displayed.

Reggie Gardner

This application works by having a service create the DataSet with the report data and write the DataSet to an xml file.

The web report then creates a DataSet from the xml file and uses that DataSet for the data source of the report.

The master report works great. But the subreports don't get any data. I will need to use report parameters and filters, but so far even without them they don't get any data. I know the xml file contains the data for the table used by the subreports. I also tried writing the DataSet back to xml after loading it from the xml file and all the data is still present. So I don't think it's a problem with the DataSet itself.

I'd like to verify that setting the subreports data source in this manner is appropriate:

subAMDaily.Report.DataSource = ds;

I tried using the NeedDataSource event, but with the same result of no data.The only suspicious thing I've noticed is that the master report fields work whether I set the DataMember property to the table name or not.

I know that the adapter and dataset are grabbing the correct information. The problem is that when the report shows up, the subreport is not showing the information from the database. I'm not sure why. In the master report in the subreport1 properties I have the ReportSource pointing to my class library and the correct report. With this, the database info just doesn't show up. When I have the reportsource not pointing to anything, then nothing shows up, which makes sense. But what could I be doing incorrectly that the information isn't showing?

Dan

I have a Report with a Subreport, both have different object DataSources; reports are displayed in an web page where DataSources are set-up. In other words I must be able to set DataSource for both reports (Master & Slave) from web-page.
How can I do that?

Thanks!

Elian

To be able to modify items in a report that serves as a sub-report, you will have to modify a bit your application. Since the introduction of the new Report Sources, the ReportSourceproperty of theSubReport item is now of type ReportSource (not Report like before).

If you are already using InstanceReportSource in the master report, then you can take the SubReportItem.ReportSource and cast it directly (instead of instantiating new DetailReport) if that works better for you.

All the best,
Elian
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.