cancel
Showing results for 
Search instead for 
Did you mean: 

"Go To Next Page" is not working.

Former Member
0 Kudos

There are many people asking the same question, but I didn't find yet clear and precise answer that works for me.

I'm upgrading my asp.net (C#) web site. I used to have CR 10.2 and I upgraded it to 13.0.2.

I read other threads and I moved my code from "page_load" to "page_init" events. Now, when I click "go to next" button, my web site freezes.

This is very frustrating. Please help me. My "page_load" code is bellow. Please let me know what I need to change to make this working. Thanks in advance.

I start my code with class declaration and some variable declarations:

public partial class Reports_FinanceCrystalReports : System.Web.UI.Page

{

private string subProgram =null;

private string program = null;

private string costCenterNumber = null;

private string division = null;

private string parentDV;

private string reportName = null;

private ReportDocument rptDocument;

private string reportSessionId;

private string isLabourReport;

private string isAuditing;

protected void Page_Load(object sender, EventArgs e)

{

reportName = Request.QueryString["ReportName"];

if (string.IsNullOrEmpty(reportName))

{

Response.Redirect("../Default.aspx");

return;

}

rptDocument = new ReportDocument();

reportName = reportName.Replace("_", "&");

division = Request.QueryString[CRParameters.VP];

program = Request.QueryString[CRParameters.Program];

subProgram = Request.QueryString[CRParameters.SubProgram];

costCenterNumber = Request.QueryString[CRParameters.CostCentre];

parentDV = Request.QueryString["Division"];

isLabourReport = Request.QueryString["IsLabor"];

isAuditing = Request.QueryString["IsAuditing"];

reportSessionId = reportName.Substring(0, reportName.LastIndexOf("."));

Page.Title = reportSessionId;

if (!string.IsNullOrEmpty(division))

{

reportSessionId += division;

}

if (!string.IsNullOrEmpty(program))

{

reportSessionId += program;

}

if (!string.IsNullOrEmpty(subProgram))

{

reportSessionId += subProgram;

}

if (!string.IsNullOrEmpty(costCenterNumber))

{

reportSessionId += costCenterNumber;

}

if (!Page.IsPostBack)

{

Session[reportSessionId] = null;

}

if (Session[reportSessionId] == null )

{

rptDocument.Load(Server.MapPath(reportName));

if (!string.IsNullOrEmpty(division))

{

SetCrystalReportParameters(CRParameters.VP, division);

}

if (!string.IsNullOrEmpty(program))

{

SetCrystalReportParameters(CRParameters.Program, program);

SetCrystalReportParameters("Division", parentDV);

}

if (!string.IsNullOrEmpty(subProgram))

{

SetCrystalReportParameters(CRParameters.SubProgram, subProgram);

SetCrystalReportParameters("Division", parentDV);

}

if (!string.IsNullOrEmpty(costCenterNumber))

{

SetCrystalReportParameters(CRParameters.CostCentre, costCenterNumber);

}

//SetCrystalReportDefaultValues(CRParameters.FiscalYearPeriod);

if (!Page.IsPostBack)

{

SetCrystalReportDefaultValues(CRParameters.FiscalYearPeriod);

this.TempFileName.Value = Guid.NewGuid().ToString();

}

CrystalReportViewer1.EnableParameterPrompt = true;

if (Page.IsPostBack)

{

if (reportName.Contains("OTST Chart Report"))

{

SetDBLogonForReport("ADSFinanceReports", rptDocument);

CrystalReportViewer1.DisplayGroupTree = true;

//CrystalReportViewer1.GroupTreeStyle

}

else

{

SetDBLogonForReport("FinanceReports", rptDocument);

}

}

SetDBLogonForReport("FinanceReports", rptDocument);

SetDBLogonForSubReport("FinanceReports", rptDocument);

CrystalReportViewer1.ReportSource = rptDocument;

CrystalReportViewer1.DataBind();

}

else

{

string path = @"TempReport\" + this.TempFileName.Value + ".rpt";

string truePath = Server.MapPath(path);

rptDocument.Load(truePath);

SetDBLogonForReport("FinanceReports", rptDocument);

SetDBLogonForSubReport("FinanceReports", rptDocument);

CrystalReportViewer1.ReportSource = rptDocument;

}

}

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Search for this KBA - 1985571 - How to use sessions in web applications using the Crystal Reports viewer (the complete code)

Open your report using it, simplify, use a report without a subreport first.

Don

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Don. Thanks for following up.

I read many threads and I did what you suggested. You can see that I said in my question that I replaced "load" with "init", but I got situation even worse (if it can be worse). After doing the change and after pressing "next" button, now my page doesn't move even to second page. I can see only wheel that is spinning indefinately.

I included my code. I inherited it and I'm beginner in ASP.net. I thought that someone looking in my code can immediately noticed what is wrong.

Could you help, please. Thanks in advance.

0 Kudos

Try searching first...

Change this:

protected void Page_Load(object sender, EventArgs e)

to this:

protected void Page_Init(object sender, EventArgs e)

Don