显示RDLC报告工具栏中的总页数

时间:2023-02-09 16:01:18

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:

我有几个使用MS ReportViewer的报告。报告显示标准的ReportViewer工具栏。在此工具栏上有一个页面导航部分,其中包含后退和前进按钮以及页数。对于我的报告,当报告首次加载时,它总是显示页面数量:

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.

我查看了RDLC属性,但找不到任何设置。

4 个解决方案

#1


7  

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.

您可以在页眉和页脚中添加一个文本框,并将其设置为Globals!TotalPages。这将强制ssrs引擎同时处理所有页面。您可以隐藏文本框。

Hope this helps.

希望这可以帮助。

#2


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.

问号表示显示的总页数不是实际页数,而是估算值。默认情况下,VS2010报表查看器控件会生成总页数作为估算值​​以提高性能。如果您愿意,可以使用ReportViewer.PageCountMode属性将页面计数模式更改为实际模式。

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

资料来源:http://social.msdn.microsoft.com/Forums/en-US/3070efeb-2eb1-4e16-a9d6-9ec8ecb36d94/reportviewer-page-controls-show-page-1-of-2-how-to-除去-问号?论坛= vsreportcontrols

#3


0  

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

有一个名为PageCountMode的属性,默认值为 - Estimate,您可以设置为Actual

#4


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.

问号表示显示的总页数不是实际页数,而是估算值。默认情况下,VS2010报表查看器控件会生成总页数作为估算值​​以提高性能。

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.

ReportViewer1是我的报表视图控件的ID。

#1


7  

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.

您可以在页眉和页脚中添加一个文本框,并将其设置为Globals!TotalPages。这将强制ssrs引擎同时处理所有页面。您可以隐藏文本框。

Hope this helps.

希望这可以帮助。

#2


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.

问号表示显示的总页数不是实际页数,而是估算值。默认情况下,VS2010报表查看器控件会生成总页数作为估算值​​以提高性能。如果您愿意,可以使用ReportViewer.PageCountMode属性将页面计数模式更改为实际模式。

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

资料来源:http://social.msdn.microsoft.com/Forums/en-US/3070efeb-2eb1-4e16-a9d6-9ec8ecb36d94/reportviewer-page-controls-show-page-1-of-2-how-to-除去-问号?论坛= vsreportcontrols

#3


0  

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

有一个名为PageCountMode的属性,默认值为 - Estimate,您可以设置为Actual

#4


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.

问号表示显示的总页数不是实际页数,而是估算值。默认情况下,VS2010报表查看器控件会生成总页数作为估算值​​以提高性能。

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.

ReportViewer1是我的报表视图控件的ID。