Skip to Content
0

"Go To Next Page" is not working.

May 31, 2017 at 08:11 PM

156

avatar image

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;

}

}

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Don Williams
Jun 08, 2017 at 07:54 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Jun 02, 2017 at 06:09 PM
0

Try searching first...

Change this:

protected void Page_Load(object sender, EventArgs e)

to this:

protected void Page_Init(object sender, EventArgs e)

Don

Share
10 |10000 characters needed characters left characters exceeded
Milenko Gataric Jun 05, 2017 at 08:27 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded