我正在使用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 里面,但是如上所述尝试不适合我 .