Reputation: 2439
I have several reports using MS ReportViewer. The reports are showing the standard ReportViewer toolbar. On this toolbar is a page navigation section with back and forward buttons and the number of pages. For my reports they when the report first loads it always shows the number of pages as such:
1 of 2?
The question mark means it hasn't calculated the total number of pages yet and if you navigate to the last page this number will update. But I would like to have this report the total page count without the user having to navigate to the last page.
I looked around the RDLC properties and couldn't find any settings for this.
Upvotes: 8
Views: 10238
Reputation: 1
The question mark means that the total page number displayed is not the actual page count, but an estimate. The VS2010 report viewer control by default generates the total page count as an estimate to improve performance.
So you can write below line into your code after you add data source to report.
ReportViewer1.PageCountMode = new PageCountMode();
ReportViewer1 is ID of my report view control.
Upvotes: 0
Reputation: 121
There is the property called PageCountMode with the default - Estimate, you can set as Actual
Upvotes: 0
Reputation: 2256
Another "cleaner" way to do it:
The question mark means that the total page number displayed is not the actual page count, but an estimate. The VS2010 report viewer control by default generates the total page count as an estimate to improve performance. If you like, you can change the page count mode to actual mode using ReportViewer.PageCountMode property.
Upvotes: 7
Reputation: 2533
You can add a textbox to the header and footer and set it to Globals!TotalPages. This will force the ssrs engine to process all the pages at the same time. You can hide the textbox though.
Hope this helps.
Upvotes: 8