Crystal报告深入研究了问题

时间:2012-04-16 18:16:40

标签: crystal-reports

好的,所以我做了一些改变并找到了某个地方。然而问题仍然存在。我发现在生成主报告时,超链接不会添加到某些字段中。但是,当我们使用相同的参数重新运行报表时(我们有一个重新运行报表的链接只更改year参数),这些字段现在有链接。这很奇怪。举一个例子,我运行2012年的报告,按链接返回2011年,然后按链接前进到2012年,链接现在在2012年工作。

1 个答案:

答案 0 :(得分:0)

您是否只在第一页加载时将“ReportDocument”对象分配给CrystalReportViewer?您应该尝试在会话中存储报表文档,并确保在回发时再次设置CrystalReportViewer控件的“ReportSource”属性。

if (!IsPostBack)
{
    // do a bunch of Crystal Report's loading stuff
    ReportDocument yourReportDocument = new ReportDocument();
    // etc, etc.
    // store the report document in server memory
    yourViewerControl.ReportSource = yourReportDocument;
    Session["theReportDocument"] = yourReportDocument;
}
else
{
    yourViewerControl.ReportSource = Session["theReportDocument"];
    yourViewerControl.Show();
}