.NET web application uses Crystal Reports for Visual Studio .NET as the reporting development tool.
When clicking the 'Next' navigation button while on page 1 of the report, page 2 appears. However, when clicking the 'Next' navigation button while on page 2, page 2 is returned again.
Why is page 2 returned instead of page 3 and how do you resolve this issue?
Hi, just in case you still have this problem - I had it too and found that it was because I had disabled viewstate for the page I had the viewer on. The control obviously tracks the page it is on using viewstate.
I just had this problem. I had the ReportSource property in Page_Load event. Which was reloading the report as if it were opening it for the first time. The report thought it was on page 1 though page 2 is the current page. I changed the ReportSource property
in the Page_init event, which allows for the settings to available for the entire lifetime of the incoming web request. It worked. Hope this helps!!!!!
I wish to confirm that the solution in this regards is to specify the ReportSource in the page_init() event rather than page_load() event.
I had a similiar code set in the Page load event . But that did not work
REM ====================================================
REM = PROBLAMATIC CODE =
REM ==================================================== Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
SqlConnection_1.ConnectionString = ConfigurationSettings.AppSettings("constring")
SqlConnection_1.Open()
StrSQL = "SELECT * FROM EMP "
SqlDataAdapter_1 = New SqlDataAdapter(StrSQL, SqlConnection_1)
SqlDataAdapter_1.Fill(DataSet_1, "CategorySales")
Dim CRptEmployee1 As New CRptEmployee
CRptEmployee1.SetDataSource(DataSet_1)
Me.Crystal ReportViewer1.ReportSource = CRptEmployee1
End Sub REM ====================================================
REM = PROBLAMATIC CODE =
REM ====================================================
Subsequently i changed to Page_init() event which worked correctly
REM ====================================================
REM = WORKING CODE =
REM ====================================================
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
SqlDataAdapter_1 = New SqlDataAdapter(StrSQL, SqlConnection_1)
SqlDataAdapter_1.Fill(DataSet_1, "CategorySales")
Dim CRptEmployee1 As New CRptEmployee
CRptEmployee1.SetDataSource(DataSet_1)
Me.CrystalReportViewer1.ReportSource = CRptEmployee1
End Sub
REM ====================================================
REM = WORKING CODE =
REM ====================================================
Congratulation the problem has been solved but my question is what is the key factor here, what is the logical difference here so that the same code when written in Page_Load event not
running properly?Can any can help me to suggest the key factor here?Thanks
in advance.
I've tried this solution of rebinding the CrystalReportViewer control in Page_Init() but I still can't page past page two on a five page document. In debugging the code correctly comes into Page_Init() , my session still holds the document but nothing happens.
My Page_Init():
protected void Page_Init(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
prakashaii
Member
156 Points
90 Posts
problem with paging in crystal report
Jul 12, 2005 05:31 AM|LINK
.NET web application uses Crystal Reports for Visual Studio .NET as the reporting development tool.
When clicking the 'Next' navigation button while on page 1 of the report, page 2 appears. However, when clicking the 'Next' navigation button while on page 2, page 2 is returned again.
Why is page 2 returned instead of page 3 and how do you resolve this issue?
Regards
Prakash Patil
DaveTichenor
Member
5 Points
1 Post
Re: problem with paging in crystal report
Oct 19, 2005 06:10 PM|LINK
thanks
Dave
julianj
Member
5 Points
2 Posts
Re: problem with paging in crystal report
Oct 26, 2005 12:39 PM|LINK
Hope this helps you out.
lattalo
Member
5 Points
1 Post
Re: problem with paging in crystal report
May 10, 2006 09:15 PM|LINK
Sougandh
Member
31 Points
12 Posts
Re: problem with paging in crystal report
Aug 23, 2006 11:00 AM|LINK
Hi There,
I wish to confirm that the solution in this regards is to specify the ReportSource in the page_init() event rather than page_load() event.
I had a similiar code set in the Page load event . But that did not work
REM ====================================================
REM = PROBLAMATIC CODE =
REM ====================================================
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
SqlConnection_1.ConnectionString = ConfigurationSettings.AppSettings("constring")
SqlConnection_1.Open()
StrSQL = "SELECT * FROM EMP "
SqlDataAdapter_1 = New SqlDataAdapter(StrSQL, SqlConnection_1)
SqlDataAdapter_1.Fill(DataSet_1, "CategorySales")
Dim CRptEmployee1 As New CRptEmployee
CRptEmployee1.SetDataSource(DataSet_1)
Me.Crystal ReportViewer1.ReportSource = CRptEmployee1
End Sub
REM ====================================================
REM = PROBLAMATIC CODE =
REM ====================================================
Subsequently i changed to Page_init() event which worked correctly
REM ====================================================
REM = WORKING CODE =
REM ====================================================
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
SqlConnection_1.ConnectionString = ConfigurationSettings.AppSettings("constring")
SqlConnection_1.Open()
StrSQL = "SELECT * FROM EMP "
SqlDataAdapter_1 = New SqlDataAdapter(StrSQL, SqlConnection_1)
SqlDataAdapter_1.Fill(DataSet_1, "CategorySales")
Dim CRptEmployee1 As New CRptEmployee
CRptEmployee1.SetDataSource(DataSet_1)
Me.CrystalReportViewer1.ReportSource = CRptEmployee1
End Sub
REM ====================================================
REM = WORKING CODE =
REM ====================================================
Thanks for the solution
Sougandh
bai
Member
12 Points
3 Posts
Re: problem with paging in crystal report
May 15, 2007 08:56 PM|LINK
http://support.businessobjects.com/documentation/product_guides/cr_net/vs_2005/html/crtsktutorialsrdparametersdiscrete.htm
The above link is the best reference to solve the above problem.
The keys are:
1) Put your ConfigureCrystalReports() in
Page_Init(object sender, EventArgs e) event,
not
Page_Load(object sender, EventArgs e)
2) Use session to keep Parameter Persistence if the report has parameters
debayan
Member
86 Points
35 Posts
Re: problem with paging in crystal report
Jun 15, 2007 10:28 AM|LINK
jimmyfingers...
Member
10 Points
32 Posts
Re: problem with paging in crystal report
Mar 19, 2008 04:11 PM|LINK
I've tried this solution of rebinding the CrystalReportViewer control in Page_Init() but I still can't page past page two on a five page document. In debugging the code correctly comes into Page_Init() , my session still holds the document but nothing happens. My Page_Init():
protected void Page_Init(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
}
else
{
if (Session["reportDocument"] != null)
{
crViewer1.ReportSource = Session["reportDocument"];
crViewer1.DataBind();
}
}
}
Anurag_Adity...
Member
2 Points
1 Post
Re: problem with paging in crystal report
Apr 23, 2008 07:08 PM|LINK
This Solution is ok with normal report but if i used 2 sub report in main report, i am facing same problem
Please anybody help me out to resolved the problem with Sub report
debayan
Member
86 Points
35 Posts
Re: problem with paging in crystal report
Aug 29, 2008 11:49 AM|LINK
Thank you , the problem has been solved using Page_Init.