我有一个水晶报告,我点击一下按钮即可。代码如下:
protected void btnGenerateReport_Click(object sender, EventArgs e)
{
List<TBL_InOutLogs> lstOfDetails = (List<TBL_InOutLogs>)Session["InOutlst"];
DataSet ds = GeneralController.ToDataSet<TBL_InOutLogs>(lstOfDetails);
string path = Server.MapPath("~/Reports/ReportName.rpt");
//ds.WriteXmlSchema(path);
ReportName rpt = new ReportName();
rpt.Load(path);
rpt.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.Visible = true;
}
我在会话中存储报告凭据,以便在回发后获取报告数据。
protected void Page_Init(object sender, EventArgs e)
{
if (IsPostBack)
{
if (Session["InOutlst"] != null)
{
DataSet ds = GeneralController.ToDataSet<TBL_InOutLogs>((List<TBL_InOutLogs>)Session["InOutlst"]);
string path = Server.MapPath("~/Reports/ReportName.rpt");
ReportName.rpt rpt = new ReportName.rpt();
rpt.Load(path);
rpt.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rpt;
CrystalReportViewer1.Visible = true;
}
}
}
现在,当我生成报告时,每件事情都很有效,但如果我将此报告导出为pdf或其他格式, sessionID 会刷新。我不希望它得到刷新。我使用IE 11,由于我的项目限制,无法在任何其他浏览器上检查它。任何解决方案的人?