Using subreport inside a table/tablix cell
In my application I have a report with one subreport contained inside a table cell. Within the SubreportProcessing event handler I supply a different set of data foreach instance of the subreport. In VS 2008 this worked okay. However, when
I switched over to VS2010 and upgraded the report file format, the behavior changed. All subreport instances in the master table now contain the data that I supplied for the first table row.
void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
// _index is a global variable that is reset to zero in the DataBind procedure.
Trip currentTrip = _trips[_index];
e.DataSources.Add(new ReportDataSource("DataSourceName", currentTrip.Items));
_index++;
}
Is this the intended behavior? How can I now supply different datasets for multiple instances of the same subreport inside a table?
Thanks in advance.
Vladislav
December 1st, 2010 8:19am
Hi Vladislav,
Does your code call remote or local reports?
thanks,
Jerry
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 1:16am
After some poking around and tinkering with my code, I found a workaround. The solution is to create a dummy parameter in the subreport, which you then need to bind to a field in the tablix dataset. Any field will do as long as both the subreport parameter
and the tablix dataset field are type-compatible. You don't have to do anything with the parameter in the subreport, but now SSRS displays multiple instances of the same subreport, a separate one for each row in the tablix.
Hope this will be helpful for someone else, too.
Vladislav
December 2nd, 2010 1:17am
After some poking around and tinkering with my code, I found a workaround. The solution is to create a dummy parameter in the subreport, which you then need to bind to a field in the tablix dataset. Any field will do as long as both the subreport parameter
and the tablix dataset field are type-compatible. You don't have to do anything with the parameter in the subreport, but now SSRS displays multiple instances of the same subreport, a separate one for each row in the tablix.
Hope this will be helpful for someone else, too.
Vladislav
Free Windows Admin Tool Kit Click here and download it now
December 2nd, 2010 1:17am
Thak you very much. The work arround works for my but finally i think this is a reporting services bug.
May 26th, 2011 3:26pm