asp.net 3.5 中的多晶报告 9.0
我可能会问一个非常基本的问题,对此我感到很抱歉。
我有一个网络应用程序,有点像报告门户。我有一个 ReportViewer.aspx 页面,其中包含 crystalreportviewer 控件,并且我使用相同的查看器来显示不同的报告。这些报告都是由其他人制作的,所以我只有一个 .rpt 文件,我已将其包含在我的项目中。
我动态提供报告数据源,因此没有静态数据绑定。(也动态传递参数)
报告通常有不止一页。
问题是当我移动到下一页时,会发生回发,并再次执行所有数据绑定。
如果我将 reportdocument 对象保存在会话中并检查 IsPostback 并将其从会话中取出,它就可以正常工作。
问题是这是否是正确的做法。因为如果我打开一个新选项卡并看到相同的报告,我最终会丢失我的第一个报告...(我可以通过执行一些奇怪的会话管理来避免这种情况,例如在查询字符串中传递 guid,然后检索正确的报告对象)但是这仍然是正确的方法吗?
任何关于如何完成它的例子都会很棒......
干杯,
奥兹
I might be asking a very basic question and I am sorry for that.
I have a web application which is sort of a reporting portal. I have a ReportViewer.aspx page which has the crystalreportviewer control on it, and i am using the same viewer to show different reports. The reports are made by someone else altogther so i just have a .rpt file which i have included in my project.
I am giving the report datasource dynamically so there is no static data binding.(passing the parameters dynamically as well)
The reports usually have more than one page.
The problem is when i move to the next page, there is a postback and it does all the databinding again.
If i save the reportdocument object in session and check IsPostback and just get it out of the session, it works fine.
The question is whether this is the correct way of doing it. coz if i open a new tab and see the same report i will end up losing my first report...(i could avoid this by doing some whacky session management like passing a guid in the querystring and then retrieving the correct report object) but still is this the right way?
any examples of how it is done would be really great...
Cheers,
Oz
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您将 ReportDocument 保留在会话中,并将其绑定到 CrystalViewer(如果是 PostBack)。
但重要的一点是在 Page_Init 而不是 Page_Load 中完成所有操作,否则当您单击下一步按钮时,多页水晶报告将卡在第 2 页上...
Well, you keep the ReportDocument in session and bind it to the CrystalViewer if PostBack.
The important point though is to do it all in Page_Init instead of Page_Load otherwise multipage crystal reports will be stuck on page 2 when you click the next button...