Tips and Tricks
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005-2015 : Tips and Tricks
Message Icon Topic: Report does not show next pages Post Reply Post New Topic
Author Message
snufse
Newbie
Newbie


Joined: 19 Mar 2008
Location: United States
Online Status: Offline
Posts: 36
Quote snufse Replybullet Topic: Report does not show next pages
    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?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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 Amazon.com or reading the 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>
IP IP Logged
snufse
Newbie
Newbie


Joined: 19 Mar 2008
Location: United States
Online Status: Offline
Posts: 36
Quote snufse Replybullet 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.

 

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet 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>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.033 seconds.