8

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.

4 Answers 4

8

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.

3
  • 1
    Absolutely this helps... I actually did this before you answered and was going to answer my own question but you beat me to it :) Commented Apr 10, 2012 at 12:59
  • 2
    Most suitable answer is given by @aleafonso Below.
    – Desmond
    Commented Apr 7, 2014 at 3:58
  • @Desmond - It was just a year and a half late. Commented Oct 27, 2016 at 0:48
7

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.

Source: http://social.msdn.microsoft.com/Forums/en-US/3070efeb-2eb1-4e16-a9d6-9ec8ecb36d94/reportviewer-page-controls-show-page-1-of-2-how-to-remove-question-mark?forum=vsreportcontrols

0

There is the property called PageCountMode with the default - Estimate, you can set as Actual

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.