6 Answers, 1 is accepted
There is a whole chapter covering the ObjectDataSource Component and how-to section covering the binding to various supported datasources. For your case (binding to dataset), you should review the How to: Bind to a DataSet help article.
We would appreciate if you elaborate on the vague parts you refer to, so we can improve the documentation.
Regards,
Steve
the Telerik team
The documentation on using ObjectDataSource for a report has a bug in it that prevents it from being useful. There is a line that reads:
var report = Report1();
Yet, there is no reference to where the Report1 class is defined or any reference to the report file itself. Can't Telerik provide a simple example to reference a specific report and change the data source of that report to a collection defined at runtime? This is by far the most common scenario.
Hi Toby,
Indeed, the code snippets use the Report1 class to represent the report definition type. It should be replaced with your custom report class that inherits from our Telerik.Reporting.Report base class - see Programmatic Report Definition Types.
You may use the Visual Studio Report Designer to create your custom report definition types.
With all due respect, I wish that more time was put into the documentation about this subject. I reviewed the programmatic types link from above and it's basically a one line description.
An object data source is going to be the primary way (by far) that any developer will use the reports. If the data source is locked into the report definition, it can be a nightmare to resolve for a variety of reasons: database connection strings change, web services replace direct connections, the database itself is changed from SQL Server to MySQl, and, most importantly, development, QA, and production environments all use different sets of data.
If the report is given the data at runtime, this eliminates all of these issues. Please, carefully document the process of creating a report and setting the datasource at runtime. The datasource should be a generic list of objects, an IEnumerable, or a DataTable (for those who are still stuck in the past).
If setting the datasource at runtime requires a custom report class, then please outline this process for us. The documentation doesn't explain it all and, basically, says to just do it. I know there must be an example somewhere in the sample code, but it would be nice to just see it without spending hours digging through the code.
Hello Toby,
Thank you for your feedback regarding our Documentation. We are currently in a process of revamping it, and you may find updated and improved articles virtually every week. Rewriting the ObjectDataSource-related articles is also in our plans, and your recommendations would be very useful.
When it comes to the data sources, please, note that they don't host any data. They hold only the meta information on how to fetch the data in run-time.
I must say that our most used data source is still the SqlDataSource. Generally, we recommend using named connection strings that let you substitute the real connection and even database type between the environments. All you need is to use the ConnectionStrings section in the configuration file to specify the real connection string that corresponds to the named one used in the report.
Regarding the WebServiceDataSource, you may provide its Service URL through a Report Parameter, or an Expression - see Using Parameters with the WebServiceDataSource component. This makes it quite flexible and suitable for multiple scenarios.
Please, note also that our Telerik.Reporting.Report class is a base report class that doesn't contain any items or sections. When you create a report in the Visual Studio Report Designer, it inherits the Report class and by default consists only of a Detail section and Page Header and Footer sections. You may add all the rest, or remove the sections you don't need.
That said, whenever you create a report through the Visual Studio Designer or with code, you inherit this base class and create your own Reporting class. This is necessary no matter what data source you would use. It's by design and lets you store your reports in a separate ReportLibrary project that you may reuse and reference in different reporting solutions.
It depends whether the SubReport item would depend on the datasource of the report containing it i.e. whether you're creating a master-detail report scenario. In such case, please review the following help article: Creating Master-Detail Reports Using SubReports.
If this is not the case, then simply bind the report through the designer like you would normally do and specify the ReportSource for the SubReport item - no additional steps are required.
Best wishes,
Steve
the Telerik team