如何在 VS2010 项目中使用 VS 2008 中的 SSRS ReportViewer?
我正在开发一个 ASP.NET MVC 2 / .NET 3.5 项目,其中包括 SSRS 2008 报告。迁移到 VS 2010 RC 后,新的 Web 表单报表查看器给我带来了很多麻烦,因此我想再次使用 VS 2008 中的旧报表查看器。现在我只是想知道最简单的方法是什么。
报表查看器嵌入在 Webforms ASPX 文件中,该文件由 MVC 视图加载到 IFrame 中。报告参数当前存储为会话变量,出于安全原因,我不想更改 HTTP POST 或 GET 参数的设置。所以我不能只是将报表查看器放在一个单独的应用程序中并使用 VS2008 构建它。
将整个项目移回 VS 2008 并不是一种选择。
那么,在 VS 2010 中使用 VS 2008 ReportViewer 最简单的方法是什么?有没有办法从 VS 2008 获取程序集并在我的项目中使用它?
谢谢,
Adrian
编辑: 我在使用 VS2010 版本的 ReportViewer 时遇到的问题与 AJAX 请求有关。例如, AsyncRendering =True 无法加载报告 和 使用分页控件或重新加载按钮也不起作用。导出按钮工作正常,但那是因为它与 AJAX 请求无关。
如果您知道如何解决此问题,我真的更愿意保留新的报告查看器。只是 我之前曾在 SO、social.msdn.com 和 MS Connect 上询问过此问题,但尚未找到答案。
I'm working on an ASP.NET MVC 2 / .NET 3.5 project which includes SSRS 2008 reports. After migrating to VS 2010 RC, the new web forms report viewer has been giving so much trouble that I'd like to use the old report viewer from VS 2008 again. Now I'm just wondering what would be the easiest way to do that.
The report viewer is embedded in a Webforms ASPX file which is loaded in an IFrame by the the MVC view. Report parameters are currently stored as session variables, and for security reasons I would prefer not to change that for HTTP POST or GET parameters. So I can't just put the report viewer in a separate application and build that with VS2008.
Moving the entire project back to VS 2008 is not an option.
So, what's the easiest way for me to use the VS 2008 ReportViewer in VS 2010? Is there way to grab an assembly from VS 2008 and use that in my project?
Thanks,
Adrian
Edit: The problems I am having with the VS2010 version of the ReportViewer are related to AJAX requests. For instance, AsyncRendering=True fails to load the report and using the paging controls or the reload button does not work either. The export button works fine, but that's because it's not related to AJAX requests.
If you have any idea how I can fix this, I'd really prefer to keep the new report viewer. It's just that I have previously asked about this on SO, on social.msdn.com and on MS Connect and have not found an answer yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您遇到的问题,您有多种选择。如果这些建议之一对您不起作用,请更详细地描述您在使用控件时遇到的问题。例如,您是否在设计器中的控件方面遇到问题,Microsoft 是否更改了其功能或 API,或者它在运行时是否行为不当?
在每个页面上替换:
在
在 web.config 中替换:在 web.config 中替换:
web.config
中替换:
在 web.config 中替换:
在 web.config 中替换:
在
如果设计器让你崩溃或给你如果您遇到麻烦,您可以将 2010 版本的控件包装在用户控件或自定义控件中,并在页面中以这种方式使用它。您仍然不会有很好的设计器经验,但如果设计器是您的问题,这可能是避免崩溃或其他问题的最佳解决方法。
如果您仍然无法使其工作,您可以返回到 VS2008 并将 2008 版本的报表查看器封装在自定义服务器控件中。然后,您可以在 2010 年项目中引用新控件。同样,您会以这种方式失去设计人员的支持。
除了这些步骤之外,您还应该登录 Microsoft Connect 并详细报告您遇到的问题,以便他们可以修复它并将其包含在 Visual Studio 2010 的 RTM(或者可能是补丁)中。
You have several options depending on the problem(s) you are experiencing. If one of these suggestions does not work for you, please describe the issues you are having with the control in more detail. For example, are you having trouble with the control in the designer, Microsoft changed its functionality or API, or is it misbehaving at runtime?
On each page replace:
With:
And in the web.config replace:
With:
And in the web.config replace:
With:
And in the web.config replace:
With:
If only the designer is crashing on you or giving you trouble, you could wrap the 2010 version of the control in a user control or custom control and consume it that way in your pages. You will still not have very good designer experience, but if the designer is your issue, this might be the best workaround to avoid crashes or other issues.
If you still can't get this to work, you could drop back into VS2008 and wrap up the 2008 version of the report viewer in a custom server control. You could then reference your new control in your 2010 project. Again, you would lose designer support this way.
In addition to these steps you should to log into Microsoft Connect and report the trouble you are having in detail, so they can fix it and include it in the RTM of Visual Studio 2010 (or perhaps a patch).
Brian Hartman 有一个专门介绍报告查看器的博客,其中涵盖了这个主题:
异步渲染以及随之而来的所有包袱
Brian Hartman has a blog devoted to Report Viewer that covers this very topic:
AsyncRendering and all the Baggage that Comes With It