无法在 ASP.NET MVC 中的 RDLC 报告中查看或添加网站数据源
在 RDLC 报告中,在 Visual Studio 2008 的“设计”视图中,我们在“网站数据源”选项卡中看不到任何内容,并且“添加新数据源”按钮呈灰色。仅启用“刷新”按钮,单击它不会执行任何操作。我们的业务逻辑层返回业务对象列表,并且业务逻辑和业务对象项目都被 MVC 项目引用。这是一个 MVC 应用程序,因此没有 App_Code 文件夹。
我们如何让业务对象出现在网站数据源列表中,以便我们可以将对象中的字段拖放到 RDLC 报告上?
In the RDLC report, in Design view in Visual Studio 2008, we don't see anything in the Website Data Sources tab and the button to Add New Data Source is grayed out. Only the Refresh button is enabled, and clicking it doesn't do anything. Our business logic layer returns Lists of business objects and the business logic and business object projects are both referenced by the MVC project. This is an MVC app, so there is no App_Code folder.
How do we get our business objects to appear in the Website Data Sources list so we can drag and drop fields from the object onto our RDLC report?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我想我也遇到过同样的问题。
我通过关闭所有打开的 VS 窗口、清理、重建解决方案,然后添加一个新的 WebForms 页面(是的,我知道它的 MVC)解决了这个问题,但它似乎触发了某些内容的刷新,并且当我们重新打开并编辑.rdlc 文件。
I think I suffered the same problem as this.
I solved this by closing all open VS windows, cleaning, rebuilding the solution then adding a new WebForms page (yes I know its MVC) but it then seemed to trigger a refresh in something and the data sources showed up when we reopened and editted the rdlc file.
我也对此感到沮丧,使用 VB.NET,但这应该可以解决它:
除了引用:
Microsoft.ReportViewer.Winforms
或Microsoft.ReportViewer.WebForms
您还需要添加对:
Microsoft.ReportViewer.Common
的引用。“数据源”面板仍为空白,但当您选择“添加数据集”时,您将看到正确的选项。
I have also been frustrated by this, using VB.NET, but this should fix it:
In addition to the reference to:
Microsoft.ReportViewer.Winforms
orMicrosoft.ReportViewer.WebForms
You need to also add a reference to:
Microsoft.ReportViewer.Common
The Data Sources panel is still blank, but when you select Add Dataset, you'll see the correct options.
试试这个...
https://msdn.microsoft.com/en-us/ Library/yft2c9ad.aspx
在菜单栏上,选择“视图”、“其他窗口”、“数据源”(或选择“Shift+Alt+D”)
Try this...
https://msdn.microsoft.com/en-us/library/yft2c9ad.aspx
On the menu bar, choose View, Other Windows, Data Sources (or choose the Shift+Alt+D
我在 Visual Studio 2008 中遇到了同样的问题。我偶然发现的解决方案是执行以下操作:
1 - 启动 VS 2008
2 - 打开解决方案
3 - 打开报告文件 (rdlc) 并确保显示“网站数据源”窗格
4 - 关闭 VS 2008(使用 rdlc“获得焦点”
5 - 启动 VS 2008
6 - 打开解决方案
您现在应该在“网站数据源”窗格中看到数据
I had the same problem in Visual Studio 2008. The solution I accidently found was to do the following:
1 - Launch VS 2008
2 - Open Solution
3 - Open report file (rdlc) and make sure "Website Data Sources" pane is showing
4 - Close VS 2008 (with the rdlc "having focus"
5 - Launch VS 2008
6 - Open Solution
You should now see the data in the Website Data Sources pane
我遇到的问题之一是我的 DataSource 类没有无参数构造函数...添加无参数构造函数后,“类”出现在 DataSource 列表中。
小细节,但花了一些时间来弄清楚。 :)
One of the problems I had was that my DataSource class didn't have a parameterless constructor...after the parameterless constructor was added "the class" showed up in the DataSource list.
Small detail, but lost some time to figure it out. :)