0
votes

I am using VS 2012 Ultimate, SAP Crystal Reports 13_0_13 (latest version).

The problem is that when I click on Crystal Report viewer's "next page" button, it goes on loading and never ends.

I am using the following code.

protected void btn_search_Click(object sender, EventArgs e)
{
     Session["ReportDocument"] = null;
     loadReport(param1,param2,param3,param4);
}

loadReport function:

private void loadReport(string Param1, string Param2, string Param3, string param4)
{
     CrystalReportViewer1.Visible = true;

     ReportDocument reportDocument = new ReportDocument();
     string reportPath = Server.MapPath(@"~/VacantAndFilledReports/rpt_vacantposts_HR.rpt");
     reportDocument.Load(reportPath);

     reportDocument.SetDatabaseLogon(ID, pass, serverName, databaseName);
     reportDocument.SetParameterValue("@Param1", Param1);
     reportDocument.SetParameterValue("@Param2", Param2);
     reportDocument.SetParameterValue("@Param3", Param3);
     reportDocument.SetParameterValue("Param4", Param4);

     CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
     CrystalReportViewer1.AutoDataBind = true;
     CrystalReportViewer1.Zoom(88);
     CrystalReportViewer1.ReportSource = reportDocument;

     Session["ReportDocument"] = reportDocument;  
}

I have also place the code in Page_Init:

protected void Page_Init(object sender, EventArgs e)
{
        if (Session["ReportDocument"] != null)
        {
            ReportDocument doc = (ReportDocument)Session["ReportDocument"];
            CrystalReportViewer1.ReportSource = doc;
        }
}

I have searched a a lot regarding Page Next button, all posts were regarding put code inside Page_Init but tried as above not work for me.

1

1 Answers

0
votes

Instead of Page_init place the same piece of code at Page_Load