Can't see or add Website Data Sources in RDLC

2019-01-19 00:14发布

问题:

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?

回答1:

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.



回答2:

I have also been frustrated by this, using VB.NET, but this should fix it:

In addition to the reference to:

  • Microsoft.ReportViewer.Winforms or
  • Microsoft.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.



回答3:

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



回答4:

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



回答5:

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. :)