Symptom
- Using the Crystal Reports SDK for Visual Studio .NET.
- The report's first page displays as expected.
- Paging to second or third page of a multipage report fails.
- No errors are thrown, but page does not change.
- Additionally, when a page number is manually entered (e.g.; page 6), the report will display the page, but paging back, the viewer displays page 1.
Environment
- SAP Crystal Reports, developer version for Microsoft Visual Studio
- Microsoft Visual Studio 2010 / 2012
Cause
- The report viewer code was in the Page_Load event:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CrystalReportViewer1.ReportSource = "C:\tests\formulas.rpt"
End Sub
Resolution
- Perform the report viweing at Page_Init:
Private Sub WebForm1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
CrystalReportViewer1.ReportSource = "C:\tests\formulas.rpt"
End Sub
See Also
- Page_Init is raised before Page_Load.
- Page_Load event does not guarantee that controls on the page are fully created when the page is used.
- In addition if a postback occurs this event is not fired again.
Keywords
crvs cr4vs 2010 2012 1st 2nd scroll move preview view screen , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To
Product
SAP Crystal Reports, developer version for Microsoft Visual Studio