Answer 3
There is some difference between Reporting Service and RDLC local report, we could drag a subreport into main report and set this subreport’s name and its parameters, then it will display correctly in the main report, however, we could not just do this in RDLC local report as in reporting service. We could display the subreport by adding an event handler for the SubreportProcessing event of the ReportViewer control. Then, manually set the data source for the report in the event handler process. Just like below code-behind:
private void <FormName>_Load(object sender, EventArgs e)
{
/*
Other code is here.
*/
this.ContactTableAdapter.Fill(this.AdventureWorksDataSet.Contact);
this.reportViewer1.LocalReport.SubreportProcessing +=
new SubreportProcessingEventHandler(SubreportProcessingEventHandler);
this.reportViewer1.RefreshReport();
/*
Other code is here.
*/
}
void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
e.DataSources.Add(new ReportDataSource("AdventureWorksDataSet_Contact", this.AdventureWorksDataSet.Contact ));
}
This is the same thread; you could click this link to get a reference http://forums.asp.net/t/1479083.aspx
Please feel free to ask.
Best regards,
Challen Fu