Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport will now show.

Status
Not open for further replies.

Jacqui1811

Programmer
Jul 8, 2002
100
SG
Hi,
I have a main report and a sub-report which gets its data from a different table.
When I run the main report it does not show the sub report.
The sub report runs on it's own as a main report and shows me the data I expect to see.
There are no parameters or anything complex.
I have added a sub report below the main report on the report designer for the main report and assigned the sub report I wish to show to it.
Can anybody help a little please :)
Regards
Jacqui.

I am using the below code in the form that has the report viewer control
private void Form1_Load(object sender, EventArgs e)
{ System.Data.SqlClient.SqlConnection(_connectionString);
this.AddressTableAdapter.Fill(this.AdventureWorksDataSet.Address);

reportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(LocalReport_SubreportProcessing);

this.reportViewer1.RefreshReport();
}

void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
{
ReportDataSource reportDataSource1 = new ReportDataSource();
reportDataSource1.Name = "AdventureWorksDataSet1_AddressType";
reportDataSource1.Value = this.AddressTypeBindingSource;
e.DataSources.Add(reportDataSource1);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top