Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working in Crystal for .net03: I'm

Status
Not open for further replies.

evilmousse

Programmer
Apr 15, 2003
85
0
0
US
Working in Crystal for .net03:
I'm having a hard time getting the current page displayed by the ASP.net CrystalReportViewer.

I got the total page count via
CStr(reportDocument.FormatEngine.GetLastPageNumber(crViewer.RequestContext()))

but I can't figure out how to get the CURRENT
page. Unfortunately, crViewer.GetCurrentPageNumber()
is for windows forms only, and little else has worked.

I know this can be done because I see the default
toolbar succeeding at it.

thx for any help,
-g
 
nobody?

i wouldn't imagine i'm the only one
who wants to accomplish this...

-g
 
I would also like to get the CURRENT page. Did you ever resolve this issue?
 
yes, actually, but it's something of a hack, as ANY solution would have to be due to the rediculous absence of .getcurrentpagenumber() in the webform crystalreportviewer object. note though, the function exists in the windows forms crystalreportviewer object.

Here is the entire function I use for the navigate event.
I set 2 labels (1 above and 1 below the report) to read "page X of Y". I use the NewPageNumber member of the navigate event, which has its' own flaws, such as the ability to return a number 1 higher than the total page count. That's why there's a little extra code. At any rate, this has been working perfectly for a few months.


Private Sub crystalreportviewer1_Navigate(ByVal source As Object, ByVal e As CrystalDecisions.Web.NavigateEventArgs) Handles crystalreportviewer1.Navigate
Dim rd As CrystalDecisions.CrystalReports.Engine.ReportDocument = prepRpt2() 'preprpt2 is my function to pass the login credentials and report perameters
crystalreportviewer1.ReportSource = rd
currentPage = e.NewPageNumber
lastPage = rd.FormatEngine.GetLastPageNumber(crystalreportviewer1.RequestContext())
If (currentPage > lastPage) Then currentPage = lastPage

lblPageNums1.Text = CStr(currentPage) + " of " + CStr(lastPage)
lblPageNums2.Text = lblPageNums1.Text
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top