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

Parent/child POCO object

1 Answer 136 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lars
Top achievements
Rank 1
Lars asked on 04 May 2015, 02:56 PM

I am trying to create a parent/child report for a single item, a Job, which contains Parts. 

I want to present the Job object, containing the Parts, to the Report. However, when I try to access the Parts, defined as List<Part>, I cannot access it's attributes, only the attributes of the List itself (Capacity and Count).

What am I doing wrong?

Thanks Larzeb 

  public class Job
   {
      public Job()
      {
         PartList = new List<JobPart>();
      }
 
      public int Id { get; set; }
      public string JobNumber { get; set; }
      public string Name { get; set; }
      public List<JobPart> PartList { get; set; }
      public DateTime ServiceDate { get; set; }
      public decimal SalesTaxRate { get; set; }
      public string Comments { get; set; }
}

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 05 May 2015, 10:50 AM
Hello Larzeb,

When there is another business object property within your business object we do not drill down into the hierarchy. To use the inner object you have to bind a Data Item to it using expressions and bindings. For more detailed information, please follow the Use DataObject as a datasource for nested data items (Table, List, Crosstab, Graph) section of the How to use ReportItem.DataObject property in expressions help article. This way you can bind the DataSource property of a data item to a given object/collection property from your business object and the data item will display the inner items.
In case you have multiple levels of nested objects, you will also need to nest data items in multiple levels in the report.
When you add a binding to the DataSource property of a nested data item (List, Table, Report), the data fields will not be available during design-time and you will need to write them manually based on the business object structure.

Regards,
Nasko
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
General Discussions
Asked by
Lars
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or