Click here to Skip to main content
15,072,209 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have a rdlc subreport. After I have retrieved all the records from database, the records will be displayed in a tablix inside the subreport. I have 10 rows of records, but when they are being passed to the subreport, it only displays the first record.
The subsequent records will disappear and would not be displayed.

I have check the properties of the tablix, I did not use "First" in the expression. Anyway I could solve this?

Below are my codes to pass the records into the subreport.

C#
long containerHeaderId = _unitDtoList.ContainerHeaderId;
//Get the report datasources from here
ReportDataSource[] reportDataSources = new ReportDataSource[2];
reportDataSources[0] = GetUnitContainerGenealogyInquiryData(_parentUnitDtoList.DtoList[_count]
                                     ,      DataTypeConversion.StringToLong(e.Parameters[0].Values[0])
                                     , containerHeaderId);

DataSet dsTrackedBy = ToDataSet(_unitGenealogyTrackedByDetails);
reportDataSources[1] = new ReportDataSource(ConstantReference.Reports.ReportDatasourceUnitGenealogyBarcodeTrackedByDetail, dsTrackedBy.Tables[0]);

//Display the report in report viewer
foreach (var dataSource in reportDataSources)
{
     e.DataSources.Add(dataSource);
}
Posted
Updated 12-Sep-21 11:45am

1 solution

On the design of the subreport, do you have a parent group on a field that has a unique ID? In my experience you need a "row" number (i.e. a unique ID for each row of data) of some kind. See solution (bullet 2) here:
http://forums.asp.net/t/2051242.aspx?ReportViewer+shows+only+first+record[^]
   
Comments
Jamie888 27-Oct-15 21:40pm
   
hi Member, thank you for your suggestion. I have found the root cause for this. It appears that List is needed to be placed under the tablix to make it works. The list control can be found in toolbox. But anyway thanks again for your effort and it may comes in handy in the future. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900