How to Get Total Page Count for a Report Using CrystalReportViewer?

Mehdi picture Mehdi · Aug 20, 2009 · Viewed 7.5k times · Source

I am using Crystal Report 2008 with C#, have a WinForm and want to show Page N of M to user in a Label.
How can I impelemnt that?
I searched and couldn't find any straightforward answer.
NOTICE: I used a CrystalReportViewer1 and CRGeneral.rpt

Answer

Mehdi picture Mehdi · Aug 27, 2009

this way works well But i think I can Find better solution:

        viewer.ShowLastPage();
        string TotalPage = viewer.GetCurrentPageNumber().ToString();
        viewer.ShowFirstPage(); 
        pageNo.Text = viewer.GetCurrentPageNumber() + " of " + TotalPage;


Any Better Answer?