Tuesday, May 29, 2007

.NET report viewer page display problem

We had a problem getting our report viewer to display the current page and page count in the ReportViewer Control.

After searching around on the internet we found a fix. This fix has to be implemented after the page renders (trying to do it right after setting the zoomMode or after form.show won't update the page numbers)

'''
''' This is to get around a bug in the report viewer which caused it not to display the page numbers.
'''

''' ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
''' ReportViewer1.ZoomMode = ZoomMode.PageWidth
'''

'''

''' The fix was found here; http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=297814&SiteID=1
Private Sub ReportViewer1_RenderingComplete(ByVal sender As Object, ByVal e As Microsoft.Reporting.WinForms.RenderingCompleteEventArgs) Handles ReportViewer1.RenderingComplete ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)

ReportViewer1.ZoomMode = ZoomMode.PageWidth

End Sub

No comments: