Pergunta

I have a main rdlc report that contains only a tablix and a subreport in it (details area). The tablix has a datasource that at runtime I checked and it is populated corectly (eg: invoices ids). The subreport has no parameters or filters.

In the handler of the SubReport processing event, I'm assigning a datatable to the subreport datasource. I also checked that the datatable has correct data in it on each raised event. For this I'm using the following code:

e.DataSources.Add(new ReportDataSource("DataSet1",myDataTable);

My problem is that when it is finished, all the pages (all the subreports) have the same data in them (it multiplies the first one by the number of id's in main datasource).

Can anybody provide some hints on what I'm doing wrong.

Thank you

Foi útil?

Solução

Ok, I finally figured it out, I have read very carefull msdn and I was missing the Parameters part for subreport. It is not mentioned that they are mandatory even if they have nothing to do with the data supplied to subreport.

Also from my test, it seems that the parameter must be passed with distinct values for each subreport processing event (if I sent it a fixed/static value it still duplicated the subreport information). So I have created a unique value field in main report data, created a new parameter for subreport, match these two in subreport properties, and now it works...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top