Contributed Controls - Crystal Report Viewer

Download

Fix for .NET 3.5 (Page Numbering was broken)

    ' The secret to getting this to work was to set the ReportSource on EVERY Postback, because the ReportSource is defined as "nonhttpcachedreportsource" - which means it is not stored in the ViewState
    Private myReportSource As Object
    Private Sub HostedPage_Load(ByVal sender As Object, ByVal e As Gizmox.WebGUI.Forms.Hosts.AspPageEventArgs) Handles Me.HostedPageLoad

        If Me.myReportSource IsNot Nothing Then
            'Remember what Page Number we're on
            Dim myCurrentPageNumber As Integer = Me.HostedCrystalReportViewer.ViewInfo.PageNumber
            'Reload Report
            Me.HostedCrystalReportViewer.ReportSource = myReportSource

            'Jump to Last Page - This prevents Page Numbers showing as: 1/1+, 2/2+
            Me.HostedCrystalReportViewer.ShowLastPage()
            'Return to Page Number
            Me.HostedCrystalReportViewer.ShowNthPage(myCurrentPageNumber)

        End If

    End Sub

Last edited May 21, 2009 at 7:35 AM by rdhatch, version 5

Comments

No comments yet.