Hello,
Can someone please point me to some sample code having a master/detail section such as is found on a purchase order or invoice that is using ASP.NET Core 3.1 or better? I can't quite seem to see how to get both of the data source hooked up properly when using an ObjectDataSource.
Thank you,
Scott
3 Answers, 1 is accepted
Hi Scott,
The ObjectDataSource can be hooked up to a report or a data item during design-time, i.e. while designing the report in a report designer. The end result would be a report document. This report document can be then displayed in many different applications, one of which can be ASP.NET Core. What I'm struggling to grasp is at which point there is trouble to hook up your data sources. You have designed the report and you are now wondering how to display them in a report viewer in ASP.NET Core? Or maybe still trying to figure out how to design the reports and setup the data sources?
Anyway, it would be helpful to share which report designer you are using and what kind of structure the data has.
Regards,
Nasko
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).
Hello Nasko,
Thanks for the reply. I have created the report in the standalone designer and all is well there the problem is it was build using two separate classes, one for the header, and one that is a list of objects for the detail. My question is how do I assigned these two classes when using the report in code? It appears that I can only make one assignment to the datasource property.
Thank you,
Scott
Hello Scott,
In Telerik Reporting, by design, only the data items may have DataSource assigned. And each data item can have only one DataSource.
You need to assign the data source with detailed data to the Report, and each data record will be rendered in a dedicated detail section instance.
You may place a data item, for example, List or Table in the Report Header and set its DataSource to the header data source. The data from the latter will be displayed in the data item. Again, a new detail section will be generated in the data item for each data source record.
Regarding the assignment of the data sources, you may use the ObjectDataSource component and make all bindings in design-time. You need to set its DataSource property to the data providing class assembly qualified name, and its DataMember to the data providing method name. The class will be instantiated run-time and the DataMember method will be invoked through System.Reflection. Note that you may pass parameters to the method/constructor that provides the data.
If you need to set the data sources run-time, you will have to instantiate the report definition - unpackage report for TRDP files and deserialize report for TRDX files. Then you may set the corresponding data item DataSource property to the data object - see supported object types. In the web projects, this may be done in the Custom ReportSource Resolver of the Telerik Reporting REST Service.
Regards,
Todor
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.