简体   繁体   English

reportviewer.LocalReport.GetTotalPages()有时返回1或2

[英]reportviewer.LocalReport.GetTotalPages() returns sometimes 1 or 2

In my application I'm using a user control, and added my report viewer and a custom toolbar. 在我的 应用程序中,我使用了一个用户控件,并添加了报表查看器和自定义工具栏。 I want to create a custom navigation for it as well. 我也想为其创建自定义导航。 But, for some reason when I want to check the total number of pages to decide whether or not to show the navigation buttons, it sometimes returns 1 or 2... I've ran out of ideas and not quite sure where to go from here.. 但是,由于某些原因,当我想检查页面总数以决定是否显示导航按钮时,有时会返回1或2 ...我的想法已经用完了,不太确定从何而来这里..

code here 这里的代码

if (rvReports.LocalReport.GetTotalPages() > 1)
{
    liFirst.Visible = true;
    liPrevious.Visible = true;
    liNext.Visible = true;
    liLast.Visible = true;
}

The amount of pages can vary with the data in the report or even for the same data by the connected/selected printer. 页面的数量可能会随报告中的数据而变化,甚至对于所连接/所选打印机的相同数据而言也会变化。 If the page count is based on the Form, it might even vary by the size of the form or the resolution of the display. 如果页数基于表单,则它甚至可能因表单的大小或显示的分辨率而异。 If you wonder why it's sometimes 1 and sometimes 2, you should find out whats different, maybe even print the report for each case and look at it. 如果您想知道为什么有时是1,有时是2,则应该找出不同之处,甚至可以打印每种情况的报告并进行查看。 You won't get any results from looking at the page count number alone. 仅查看页数不会获得任何结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 reportviewer.LocalReport.GetTotalPages()返回0或错误 - reportviewer.LocalReport.GetTotalPages() returns 0 or error 在winform的ReportViewer的LocalReport中导出为CSV - Export to CSV in LocalReport of ReportViewer of winform 在本地报表中运行多个数据集的ReportViewer - ReportViewer with multiple dataset running in localreport 以黑白PDF格式从Reportviewer渲染LocalReport - Render LocalReport from Reportviewer in Black and White PDF Visual Studio中devexpress的ReportViewer控件无法识别LocalReport属性 - ReportViewer control of devexpress in visual studio that does not recognize the LocalReport property 从Microsoft.ReportViewer.LocalReport中导出PDF导出中的条形码 - Rendering barcodes in PDF export from Microsoft.ReportViewer.LocalReport 在ASP.NET ReportViewer控件中使用远程SSRS数据源运行LocalReport - Running a LocalReport with a remote SSRS DataSource in ASP.NET ReportViewer control ReportViewer.LocalReport.Refresh和ReportViewer.RefreshData有什么区别? - What's the difference between ReportViewer.LocalReport.Refresh and ReportViewer.RefreshData? LocalReport-渲染Excel返回0长度字节数组 - LocalReport - Render Excel returns 0-length byte array 将自定义文化与ReportViewer一起使用会返回CultureNotFoundException - Using Custom Culture with ReportViewer returns a CultureNotFoundException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM