Print Page | Close Window

Report does not show next pages

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=5148
Printed Date: 01 May 2025 at 2:12pm


Topic: Report does not show next pages
Posted By: snufse
Subject: Report does not show next pages
Date Posted: 06 Jan 2009 at 10:17am
I have following code:
 

Private Sub Run_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Run_Button.Click

Dim myPath As String = Server.MapPath("") + "\ProjectDailyReport.rpt"

myCrystalReport1.Load(myPath)

myCrystalReport1.SetParameterValue("BatchGuid", "{96084E02-787D-43AF-8E55-001F4E5AF8B7}")

myCrystalReport1.SetDatabaseLogon("xx", "yy")

CrystalReportViewer1.ReportSource = myCrystalReport1

CrystalReportViewer1.Zoom(95)

End Sub

The report displays the first page OK. There are always 4 pages to the report and when I click on next page it does not show any of the next pages (just blank page). The viewer is located within a panel.

Now, if I run the report manually (opening the report in CR XI) it works fine and I am able to page. Any ideas?



Replies:
Posted By: BrianBischof
Date Posted: 06 Jan 2009 at 1:10pm
You need to put the code that loads the report into the Page_Init() event. Then save the report in the Session() collection and retrieve it when Page.IsPostBack() is true.
 
I have a completely optimized ASP.NET template in my CR.NET 2008 book. You can find out more about my books at http://www.amazon.com/exec/obidos/ASIN/097495361X/bischofsystem-20 - Amazon.com or reading the http://members.crystalreportsbook.com - Crystal Reports eBooks online.


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: snufse
Date Posted: 06 Jan 2009 at 1:24pm
Brian, this is what I did and it works fine:
 

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

If IsPostBack Then

Dim myPath As String = Server.MapPath("") + "\ProjectDailyReport.rpt"

myCrystalReport1.Load(myPath)

myCrystalReport1.SetParameterValue("BatchGuid", "{96084E02-787D-43AF-8E55-001F4E5AF8B7}")

myCrystalReport1.SetDatabaseLogon("xx", "yy")

CrystalReportViewer1.ReportSource = myCrystalReport1

CrystalReportViewer1.Zoom(90)

End If

End Sub

Private Sub Run_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Run_Button.Click

End Sub

I'm using a button to initiate the load of the report after user puts in the report nunmber they want.

 



Posted By: BrianBischof
Date Posted: 06 Jan 2009 at 1:36pm

Great. However, you should still use the Session() collection to store the report b/c this will reduce the hits to the database server b/c it doesn't have to login and reload the data each time.



-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window