Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Object data source in ASP.NET 4 ReportViewer

OK, I think I'm getting mad here... I thought this should be super simple, but I just can't figure out how to do that.

This is what I'm trying to do: I want to create an rdlc report using the ReportViewer control in ASP.NET 4 (VS 2010), and, as its datasource, use a class with some properties. I tried everything I can think of, but I just can't figure this out. All the docs I found state that the object should appear in the DataSource pane of the website, but I can't make it appear there. I would like the fields of the class to appear in the report desiger so I can use them - but I can't do that either. Using the designer, I can only define new dataset - I don't want to use dataset, but business objects!

So - how can I do that? Do I have to use some kind of DataSource control? How can I make the report designer know about the business object?

Thanks!

Memi

like image 988
Memi Avatar asked Nov 22 '10 16:11

Memi


1 Answers

did you follow this tutorial?
everything you must do is:

  • define your DTO classes or generate it using EF4 (for example)
  • define your business classes with some methods (like GetAll...)
  • build your solution (that's important)

now from your report designer you can choose methods from business classes as dataset and drag and drop field from the DTO classes
when you choose that report to display in the reportviewer, the datasource object will be added for you

like image 132
hope_is_grim Avatar answered Sep 28 '22 01:09

hope_is_grim