Crystal Report Viewer下一页按钮在ASP.NET中不起作用

时间:2015-02-17 05:44:06

标签: c# asp.net crystal-reports

我使用的是VS 2012 Ultimate,SAP Crystal Reports 13_0_13(最新版本)。

问题是当我点击Crystal Report查看器的“下一页”按钮时,它会继续加载并且永远不会结束。

我正在使用以下代码。

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

loadReport功能:

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;  
}

我还将代码放在Page_Init

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

我搜索过很多关于Page Next按钮的内容,所有帖子都是关于Page_Init内的代码,但是如上所述尝试对我不起作用。

1 个答案:

答案 0 :(得分:0)

而不是Page_init在Page_Load

放置相同的代码