Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table named PayslipData. I have created a report which Prints Payslip for employee for a particular month. The report is working fine for single employee. BUT now I want to print payslips for ALL employees at a single click of a button. That means the RDLC format which I have prepared should print all these payslips
in succession and show all these payslips one below each other in the reportviewer so that I can use Print Button at the top panel to print all these at one go. I am stuck here for many days. Please help.

My code goes like this

C#
ReportViewer1.LocalReport.DataSources.Clear()
          Dim reportDSHeader As New ReportDataSource("DataSet1", ds.Tables(0))
          Dim reportpath As String = "Reports\PayslipPrint.rdlc"            ReportViewer1.LocalReport.ReportPath = reportpath
          ReportViewer1.LocalReport.DataSources.Add(reportDSHeader)
          ReportViewer1.LocalReport.Refresh()

I am geting the entire dataset properly, but while showing the report, it shows only single record.
Posted
Updated 26-Mar-12 23:13pm
v2

Hello vbguy,

What I usually do is just wrap the whole content of the report body(including labels and everything) inside a List[^] element, and then assign the datasource to that list. This will iterate over all the elements of your datasource and you should have your report displaying multiple payslips if your datasource contains more than 1.
 
Share this answer
 
Hello andrusha007

Thanks a lot for your kind help.

I tried it and it is repeating that Payslip format for all the records. Only the hitch now is it is showing Data for Only one record at ALL places. I might have goofed up somewhere or I think do I need to add Group By to that list?

Will try to figure out the problem today. If you know where I might be going wrong, then please let me know.

Anyways my hearttfelt thanks for your help.
 
Share this answer
 
I am doing the same thing in my project, only thing you need to do is put everything in a list and one group should be created on employee in on list.

That works for me.

Hope this helps.
 
Share this answer
 
Comments
thevbguy1 22-Mar-12 8:37am    
Hello I created a row group. Now it is showing Individual employee no. on left side of each Payslip. BUT STILL it is printing 5 payslips with the SAME DATA. I cant figure out where I am going wrong. Can I email you the rdlc??? your email please.
hiren soni 22-Mar-12 8:42am    
Sure...You can send me on hirensoni913@gmail.com and also send me the pdf format of your current report where you are going wrong.
thevbguy1 24-Mar-12 0:16am    
Hi Hiren. I sent you the mail yesterday.
hiren soni 24-Mar-12 1:21am    
Haven't got any email to be honest.
thevbguy1 24-Mar-12 3:50am    
Sent again just now.. @1.20 PM.
Pl. also check spam folder.
Hello
My problem is resolved. Thanks to andrusha00 for replying to my query at first place and to Hiren Soni for looking at the code which I had sent and suggesting a fix for that. Thanks to both of you.
 
Share this answer
 
Comments
Member 8948937 24-Sep-12 2:40am    
i have same problem.can u please share me the code

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