Using .NET Class as the DataSource with SSRS RDLC

前端 未结 2 545
醉话见心
醉话见心 2021-02-06 05:51

I have a MVC4 application in Visual Studio 2010 which contains plenty of classes. I\'m trying to use them to pass in as the DataSource for a Report Definition Language Client (

2条回答
  •  攒了一身酷
    2021-02-06 06:47

    Here are a couple solutions, but I prefer the second one.

    Solution 1 (okay)

    As this appears to be a bug with the MVC Web Application project type itself, you can add the report to a different project type (like Class Library). As described in the post Visual Studio 2010 Report Viewer - Object Datasource, just create a separate library for the project and add the rdlc file there. The data source configuration wizard should now look like this:

    data source configuration wizard

    Solution 2 (better)

    As figured out in Can't see or add Website Data Sources in RDLC report in ASP.NET MVC, you can just add an aspx page anywhere to the MVC project to trick Visual Studio into pulling in the right design time libraries.

    Just do the following:

    • Close all windows
    • Clean & Rebuild Solution
    • Add WebForm1.aspx to the Project
    • Open up the RDLC file and choose a DataSource from the dropdown:

      DataSource Dropdown

提交回复
热议问题