This is a migrated thread and some comments may be shown as answers.

ObjectDataSource Sample Report?

6 Answers 1243 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff Reinhardt
Top achievements
Rank 1
Jeff Reinhardt asked on 20 Aug 2010, 04:13 PM
I have my own DAL and BLL I want to use with Telerik Reporting but the documentation is vague on using ObjectDataSource and binding it to a report, etc.  Do you have a sample of using a BLL that returns say a DataSet for the report?

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 25 Aug 2010, 09:22 AM
Hello Jeff,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Toby
Top achievements
Rank 1
commented on 28 Aug 2022, 06:34 PM

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.

Todor
Telerik team
commented on 31 Aug 2022, 08:37 AM

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.

Toby
Top achievements
Rank 1
commented on 31 Aug 2022, 01:36 PM

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.

Todor
Telerik team
commented on 05 Sep 2022, 12:05 PM

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.

0
Jeff Reinhardt
Top achievements
Rank 1
answered on 25 Aug 2010, 01:28 PM
Well, the article you sent me to for instance.  I know how to pull a dataset and set the report datasource to it.  How do I bind fields in the report to an object that does not exist in the report.  All of your report examples show datasources attached and such.  I am not sure how to put my fields on the report.
0
Jeff Reinhardt
Top achievements
Rank 1
answered on 25 Aug 2010, 02:00 PM
Ok I figured it out, but how would I bind the datasource for a subreport to the dataset I need?
0
Steve
Telerik team
answered on 30 Aug 2010, 09:00 AM
Hello Jeff,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
JOSE
Top achievements
Rank 1
answered on 16 Nov 2016, 06:09 PM
No Steve; I don't belive this is the answer, I think this is refered to some like my problem: I have a DataGrid in a user control of my WPF app, and I want when the user selects some rows from here, send DataGrid.SelectedItems as DataSource to my Telerik Report, and I don't know how i can do this
Toby
Top achievements
Rank 1
commented on 31 Aug 2022, 03:30 PM

I do this same thing with a DataGrid quite often.  It's a very useful way to present the data to the user and allow for customized data to be sent to the report.  A very common scenario.
0
JOSE
Top achievements
Rank 1
answered on 16 Nov 2016, 06:09 PM
No Steve; I don't belive this is the answer, I think this is refered to some like my problem: I have a DataGrid in a user control of my WPF app, and I want when the user selects some rows from here, send DataGrid.SelectedItems as DataSource to my Telerik Report, and I don't know how i can do this
Tags
General Discussions
Asked by
Jeff Reinhardt
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jeff Reinhardt
Top achievements
Rank 1
JOSE
Top achievements
Rank 1
Share this question
or