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

Class as ObjectDataSource

5 Answers 184 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Masoud
Top achievements
Rank 1
Masoud asked on 05 Apr 2012, 11:14 AM
Hi there,

I am looking at generating reports based on a class that has the following structure:

public class DataItem
{
    public string ItemHeader { get; set; }
    public string ItemContent { get; set; }
    public string ItemFooter { get; set; }
}
 
public class ReportingDataSource00
{
    public ReportingDataSource00()
    {
        DataItems = new List<DataItem>
                        {
                            new DataItem {ItemContent = "ItemContent00", ItemFooter = "Footer00", ItemHeader = "Header00"},
                            new DataItem {ItemContent = "ItemContent01", ItemFooter = "Footer01", ItemHeader = "Header01"}
                        };
        ReportHeader = "Header";
        ReportFooter = "Footer";
    }
 
    public string ReportHeader { get; set; }
    public string ReportFooter { get; set; }
    public IEnumerable<DataItem> DataItems { get; set; }
}

ReportingDataSource00 has data that needs to be displayed only once on the report (header and footer), as well as a list of elements that need to be displayed in a table.  

When I try to use ReportingDataSource00 as a ObjectDataSource, the wizard will only recognize the properties Header and Footer.  Is it possible to use the DataItems list as a datasource for a list in the detail section of the report?

Best regardes




5 Answers, 1 is accepted

Sort by
0
Accepted
Elian
Telerik team
answered on 09 Apr 2012, 12:03 PM
Hi Klaus,

The concept of the DataSource is to be a List of some data items that will be iterated through in order to create the report (one detail section for each iteration). In your case the List is not the top of the hierarchy and this is why you can't use the DataItems List for displaying items in the detail section. You can however use it as DataSource for Table/List/Crosstab items with Bindings. However if you need to use it as Report.DataSource you will need to rework it, so it only retrieves the data for the report (without the header and the footer). 

Regards,
Elian
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
InSource
Top achievements
Rank 1
answered on 08 May 2012, 02:35 PM
I have an MVC application that uses business object classes and a DAL.
I wish to use telerik reporting in my application using these classes but am having difficulty finding examples of how to use the objectDataSource.  Can you provide a snippet or an example?
0
Steve
Telerik team
answered on 08 May 2012, 02:39 PM
Hello,

Check the following links:

Kind regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
John
Top achievements
Rank 1
answered on 19 Nov 2017, 07:51 PM
Then how would you get the header and footer info? should we repeat the header and footer information in the collection so we can use it?
0
Katia
Telerik team
answered on 22 Nov 2017, 12:54 PM
Hi John,

Header and footer information can be retrieved inside the report's (or inner data item) detail section. In this case, header and footer will be repeated for each detail section. Otherwise, you can show only the ItemContent in the detail section and display header and footer in another report section where the content can be aggregated, for example Group Header(Footer) or Report Header(Footer).
Inside those sections, you can use aggregate built-in functions to calculate the result based on the set of values returned by the data source.

Regards,
Katia
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Masoud
Top achievements
Rank 1
Answers by
Elian
Telerik team
InSource
Top achievements
Rank 1
Steve
Telerik team
John
Top achievements
Rank 1
Katia
Telerik team
Share this question
or