Hello. I
have created a report using the Standalone Designer. I am able to display the
report in an MVC view using an HTML5 Report Viewer but I have not been able to
display data using ObjectDataSource and an in-memory business object.
I found
this post by Stef on the forums (16 Jul 2014):
“The HTML5 Report Viewer and the Reporting REST
service does not use the MVC concept. Thus if you have a model containing data
or other information required in your reports, you need to implement a logic to
access that model in the reports' controller e.g. to store the data and access
it by key in the service's resolver, or to modify the reports to use such data
source component, that wraps a data retrieval method having access to that
model.”
¿Could you
please elaborate how this is done?
The post
continues: “… A demo
of a report that uses a custom data retrieval method is available in the local
examples under C:\Program Files (x86)\Telerik\Reporting Q2 2014\Examples\CSharp\ReportLibrary\DataBinding.
The ListBoundReport uses an ObjectDataSource to retrieve data from a custom
business object. This business object can be modified anywhere in the
application, when the report is requested its ObjectDataSource will search for
the assigned data retrieval method and will get the data.”
I have
reviewed the example but I still don’t get how it works. The objectDataSource1
has DataSource assigned but no DataMember assigned. Shouldn’t the DataMember
property contain the data retrieval method name mentioned in Stef’s post to get
the data? In any case, how does it know what instance of the class should be
used to retrieve the data from? Let’s say I have a Product class and there are
2 instances of this class: productA and productB, How do I tell ObjectDataSource
to use product for instance?
Thank you very much in advanced,
Humberto