Tuesday, March 25, 2014

RDLC Design- Create Dataset from your own class

I have problem in linking report dataset to my own defined class (which is not bound with database/model) when trying to design a RDLC report in MVC Code first.

I added my project in the data source, but the class doesn't appear in the dataset of Report data.

The reason was because the class that I created didn't have ID field.
So, the problem solve after I added the int ID field in as below:






The "ProductData" class is not bound to any database table or model.
After compiled, you can add the dataset in your report:
- View menu --> Report Data --> Right click on Datasets --> Add Dataset
- Choose Object --> Next
- Select the project and namespace where the ProductData is belong to