views:

306

answers:

2

I am using the Crystal Report Viewer in an ASP.NET application. On the viewer it displays the page numbers along the lines of '1 / 1+' where the 1+ is dynamically calculated. I would like it to display the correct total number of pages from the start rather than 1+. Is there a way to do this?

+2  A: 

I think a number of the examples online recommend that you navigate to the last page and then back to the first, but I don't think this is a good way of handling it. I have yet to have the need to do this for any of my projects so I haven't had to try to find a work around yet.

Edit-

Ok, after looking at this just now I realized that if you add the "Page N of M" special field it does the dynamic calculation at runtime. In my testing it will do the dynamic calculation even if you choose to suppress the field by checking the suppress box in the field properties. Granted the dynamic calculation might be slower for larger reports, this is probably just as good as programmatically navigating to the last page and back to the first. Hope this helps.

Dusty
Thanks Dusty. Just adding a Page N of M on and suppressing it will have the desired effect.
Craig
A: 

Crystal Report's Page engine renders sections the first page as quickly as possible to give the perception of performance. You may have noticed field values rendering quickly, with place holders (spaces) for subreports and other resource-intensive objects. As the Rendering engine finishes processing these objects, the place holders are replace with values.

The page numbering situation is similar. The navigation control will initially read '1+', but will increment as the Page engine renders additional pages. When the whole report is rendered, the navigation control and the Page N of M field will display the total page count.

If you insist on altering the user-experience, you may be able to use the Viewer's BeforeRender or BeforeRenderContent event to set HasPageNavigationButtons=False and AfterRender or AfterRenderContent event to HasPageNavigationButtons=True.

I'm not certain that you will be able to do something similar with the Page-N-of-M field.

Craig