Using .NET Class as the DataSource with SSRS RDLC

KyleMit

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 (RDLC) file. But I can't access the classes from my assembly anywhere in the data source designer

According to the MSDN Walkthrough on Using a Business Object Data Source with the ReportViewer Web Server Control in Local Processing Mode, I should be able to do so in the Dataset Properties page

In the Dataset Properties page, in the Data source box, select global.

According to this Stackoverflow question on How to use an Object data source in report (.rdlc), when in Dataset Properties page, I should be able to create a new data source like this:

Creating a New Data source:

  • Select Object and click Next.
  • Browse the solution tree and select the class(es) you want to bind to.
  • Click Finish.

But neither of these present as options...

When I create a new dataset, nothing shows up under Data Source:

DataSet Properties

When I click New to create a New DataSource, I just get a connection Wizard that forces me to connect to a database:

Data Source Configuration Wizard

Where can I add classes from my assembly?

As a trivial example, here's an example of an object I have built into the assembly that I would expect to show up:

Public Class Employee
    Public Property Name As String
    Public Property ID As Integer
End Class

I would eventually like to populate this information programmatically like this:

Dim lr As New LocalReport
lr.ReportPath = Server.MapPath("~\Reports\Report1.rdlc")
lr.DataSources.Add(New ReportDataSource("Data", New Employee("Kyle",27)))
KyleMit

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

RDLC / SSRS report using external image with "#" in filename

From Dev

SSRS single datasource impact

From Dev

No report display in asp.net mvc using rdlc

From Dev

RDLC Report with a List of Lists as its Datasource

From Dev

SSRS DataSource Windows Authentication fails

From Dev

How to print a .rdlc (SSRS) report as duplex mode?

From Dev

Populating ListBox with a List(T) Class. Not using datasource

From Dev

ext.net mvc gridpanel using datasource with complex model type

From Dev

I want to set datasource of rdlc report with model in MVC 4

From Dev

Rdlc Reporting C#.net

From Dev

how to create RDLC report using multiple sql columns with same values to count in vb.net

From Dev

Use static class as datasource

From Dev

how to avoid to Specify a username and password for datasource in SSRS?

From Dev

Define SSRS report's DataSet and DataSource dynamically

From Dev

Change connection string of datasource on build for SSRS Project

From Dev

Connecting Excel 2013 to SSRS 2012 to use as a datasource

From Dev

Connecting Excel 2013 to SSRS 2012 to use as a datasource

From Dev

SSRS Matrix Bespoke Headers (Still from datasource!!)

From Dev

SSRS Bearer Token for Web Api Datasource

From Dev

Uploading SSRS report causes datasource to require credentials

From Dev

Generate Admit Card using RDLC

From Dev

RDLC Reporting using C#

From Dev

Cannot see RDLC code tab in SSRS visual studio

From Dev

Using HttpClient inside ASP.NET MVC Action to call SSRS

From Dev

.net - Using Class as one parameter

From Dev

Using a Dictionary as a combobox DataSource

From Dev

Closing DataSource and Using Cursor

From Dev

breezejs how to using as datasource

From Dev

.NET 2013 RDLC Reports, Date Formatting

Related Related

  1. 1

    RDLC / SSRS report using external image with "#" in filename

  2. 2

    SSRS single datasource impact

  3. 3

    No report display in asp.net mvc using rdlc

  4. 4

    RDLC Report with a List of Lists as its Datasource

  5. 5

    SSRS DataSource Windows Authentication fails

  6. 6

    How to print a .rdlc (SSRS) report as duplex mode?

  7. 7

    Populating ListBox with a List(T) Class. Not using datasource

  8. 8

    ext.net mvc gridpanel using datasource with complex model type

  9. 9

    I want to set datasource of rdlc report with model in MVC 4

  10. 10

    Rdlc Reporting C#.net

  11. 11

    how to create RDLC report using multiple sql columns with same values to count in vb.net

  12. 12

    Use static class as datasource

  13. 13

    how to avoid to Specify a username and password for datasource in SSRS?

  14. 14

    Define SSRS report's DataSet and DataSource dynamically

  15. 15

    Change connection string of datasource on build for SSRS Project

  16. 16

    Connecting Excel 2013 to SSRS 2012 to use as a datasource

  17. 17

    Connecting Excel 2013 to SSRS 2012 to use as a datasource

  18. 18

    SSRS Matrix Bespoke Headers (Still from datasource!!)

  19. 19

    SSRS Bearer Token for Web Api Datasource

  20. 20

    Uploading SSRS report causes datasource to require credentials

  21. 21

    Generate Admit Card using RDLC

  22. 22

    RDLC Reporting using C#

  23. 23

    Cannot see RDLC code tab in SSRS visual studio

  24. 24

    Using HttpClient inside ASP.NET MVC Action to call SSRS

  25. 25

    .net - Using Class as one parameter

  26. 26

    Using a Dictionary as a combobox DataSource

  27. 27

    Closing DataSource and Using Cursor

  28. 28

    breezejs how to using as datasource

  29. 29

    .NET 2013 RDLC Reports, Date Formatting

HotTag

Archive