ASP.NET MVC VS2010水晶报表Beta 2中无法打印,导出,缩放,或更改页面 [英] ASP.NET MVC VS2010 Crystal Reports Beta 2 Can't Print, Export, Zoom, or Change Pages

查看:553
本文介绍了ASP.NET MVC VS2010水晶报表Beta 2中无法打印,导出,缩放,或更改页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级到Crystal Reports的beta 2 Visual Studio 2010和我不能同时使用在ASP.NET MVC应用程序的Web控制,打印,导出,缩放或更改网页。

I just upgraded to the beta 2 of Crystal Reports for Visual Studio 2010 and I'm not able to print, export, zoom, or change pages while using the web control in an ASP.NET MVC application.

我可以得到报告运行并显示在网页上就好了。所有的按键都具有图像和报告数据看起来完全相同,因为它应该在页面上。

I can get the report to run and display just fine on the webpage. All of the buttons have images, and the report data looks exactly as it should on the page.

在VS2010在注视.RPT我可以点击报告preVIEW,并获得运行报表和打印,导出,缩放,等等...这似乎是使用Windows控制呈现报表和没有网络的控制。因此,我相信我的报表文件本身是有效的。

In VS2010 while looking at the .rpt I can click 'Report Preview' and get the report to run and print, export, zoom, etc...this appears to use the windows control to render the report and not the web control. Thus I believe my report file itself is valid.

在网页上观看在Crystal Reports浏览器,我得到不同的功能报告,当我尝试每个按钮:

While on the webpage viewing the report in the Crystal Reports Viewer I get different functionality when I try each of the buttons:


  • 打印:点击打印按钮一次,该报告可追溯到Web服务器,请重新运行报表,但随后又回到了网页,什么都不做。 preSS再次和它打开与这个新的选项卡中的同一份报告中一个新的标签。

  • 导出:打开的对话​​框中问我,我想导出的格式。一旦我做出选择它执行相同的功能打印呢,去到后端,然后什么。 pressing出口再次打开了它的报告中一个新的标签。

  • 放大/更改页面 - 这两个选项弹出一个对话框,一个微调,然后冻结页

我获得相同的行为,无论我使用哪种浏览器(IE,浏览器,Mozilla),和所有的浏览器都弹出窗口阻止程序关闭。

I get the same behavior regardless of which browser I use, (IE, Chrome, Mozilla), and all of the browsers have pop-up blocker turned off.

使用Chrome的开发者工具我得到在页面上两个错误:

Using Chrome's developer tools I do get two errors on the page:


  • JobHistory:[是由脚本生成导致此错误的HTML] 59无可比拟的遭遇。忽略标签。

  • JobHistory:[是由脚本生成导致此错误的HTML] 59无可比拟的遭遇。忽略标签。

我试过其他项目:


    水晶报表的
  • 删除所有previous版本

  • 卸载,然后重新安装水晶报表
  • 的测试版2
  • 重新启动的从头开始我的解决方案,最初是从2008年的升级版。

  • 十字贴在水晶报表测试这个问题2论坛

这件事的任何想法或建议,我可以尝试有很大的AP preciated。

Any thoughts or suggestions on things I could try are greatly appreciated.

推荐答案

水晶报表的报表查看器控件是一个服务器端控制,因此,它不能正常工作时,一个MVC视图页面的一部分。因此,当我试图打印或导出,造成后回来,我就不断地看,而不是打印或导出页面刷新。

Crystal Report's Report Viewer control is a server side control, as such, it doesn't function properly when part of an MVC view page. Hence, when I tried to print or export, causing a post back, I would continually see a page refresh, instead of printing or exporting.

此行​​为是ASP.NET MVC 1版,我与Visual Studio 2008和Crystal Reports的与VS2008附带的版本中使用的不同。在VS2010和现在一样公测时,Crystal Reports 2010的,报表查看器控件需要是一个普通的老式aspx页面上,而不是一个MVC视图页面的一部分。

This behavior is different from ASP.NET MVC version 1 that I used with Visual Studio 2008 and the version of Crystal Reports that came with VS2008. In VS2010 and, as of now beta of, Crystal Reports 2010, the Report Viewer control needs to be on a plain old aspx page and not part of an MVC view page.

要做到这一点,我采取了以下措施,许多这些步骤是萨姆斯那些我在一个相关的问题之前使用,但我已经调整了他们在VS2010和水晶报表2010看到了新的行为:<一href=\"http://stackoverflow.com/questions/154702/crystalreportviewer-buttons-broken-using-mvc-framework\">StackOverflow.com:使用MVC框架残破的CrystalReportViewer按钮

To accomplish this I took the following steps, many of these steps are the sames ones I used before in a related question, but I have tweaked them for the new behavior seen in VS2010 and CrystalReports 2010: StackOverflow.com: CrystalReportViewer Buttons Broken using MVC Framework


  • 在我的控制器中我调用适当的调用我的模型,以获得我的报告数据,

列表&LT; JobSummaryBody&GT;体= model.GetJobSummaryBody(的jobId,的startDate,结束日期);


  • 接下来,我创建报表本身varible,在这种情况下:

JobSummaryByDate总结=新JobSummaryByDate();

请注意:JobSummaryByDate是当我设计我的报告的Crystal Reports创建的数据类型,它是code产生的。把它看成是一切,你设计的报表将需要的数据。

Note: JobSummaryByDate is a data type created by Crystal Reports when I design my report, it is code generated. Think of it as all of the data that your designed report is going to need.


  • 接下来我设置了数据源,行数据,报告我刚刚创建

summary.SetDataSource(身体);


  • 最后,我存储在会话我的报告数据,并做了Response.Redirect的到我的aspx页面保存的Crystal报表查看

会话[ReportData] =摘要;
的Response.Redirect(〜/水晶报表/ JobSummaryByDateView.aspx);

请注意:我已经创建了我的项目被称为水晶报表的新顶层文件夹,该文件夹其实是可以通过网址导航到

Note: I have created a new top level folder in my project called "CrystalReports", the folder can actually be navigated to by URL.


  • 有关JobSummaryByDateView.asp源页面非常striaght前锋,加上水晶报表查看器,在这种情况下,我把它报告查看器的ID:

  • The source page for JobSummaryByDateView.asp is very striaght forward, add the Crystal Report Viewer, in this case I gave it an ID of Report Viewer:

&LT; CR:ID的CrystalReportViewer =的ReportViewer=服务器AutoDataBind =真
            EnableDatabaseLogonPrompt =假EnableParameterPrompt =假
        ToolPanelView =无HasDrilldownTabs =FALSEHasDrillUpButton =FALSE
        HasSearchButton =假HasToggleGroupTreeButton =假
        HasToggleParameterPanelButton =FALSEReuseParameterValues​​OnRefresh =真/&GT;

保护无效Page_Init(对象发件人,EventArgs的发送)
        {
            ReportViewer.ReportSource =会话[ReportData];
        }

这篇关于ASP.NET MVC VS2010水晶报表Beta 2中无法打印,导出,缩放,或更改页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆