简体   繁体   中英

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..

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. You won't get any results from looking at the page count number alone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM