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

List in List in List .. etc

3 Answers 683 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Horia
Top achievements
Rank 1
Horia asked on 17 Mar 2011, 09:54 PM
Hi,

I need to build a report which has its DataSource a List<Object1>
Object1 has a List<Object2>
Object2 has a List<Object3>

All objects have a property Name(and some other details)

Report should show like:

Object1.Name
* Object2.Name
** Object3.Name
** Object3.Name
* Object2.Name
** Object3.Name
** Object3.Name

Object1.Name
* Object2.Name
... and so on.

I`ve created a list1 which has the datasource - List<Object1>, but after this I got stuck, I can't find a way to set the datasource for the next list which would need to show Object2 list, and after that, Object3 list. How can I achieve this without building the controls from code?

I must mention i`m new in working with telerik, in case this was not found out yet.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Stephan
Telerik team
answered on 18 Mar 2011, 06:37 PM
Hello Horia,

We've created a simple demo showing how the data hierarchy can be represented by nested List report items. 
In the attached picture, you can see how the Report Designer and Report Explorer look like. The root object (ObjectDataSource1) is bound to the Level1List. To supply data to the nested lists we've used bindings - DataSource=Fields.Children.

One inconsistency between the data layout and the report representation is the empty space when data items have no children. To avoid this, you can decrease the size of the respective list and set:
Visible= IIf(Fields.Children.Count>0,True,False) through Bindings.

Regards,
Stephan
the Telerik team
0
Simon
Top achievements
Rank 1
answered on 25 Oct 2018, 12:30 PM

Hello Stephan,
interesting thing.
I have installed your files in my project and I had to realize that
double up the data in the preview.

Object 21 and 22 is still in object 12.

How can I prevent this from happening?

What must be cleared in the designer file?

 

 

0
Todor
Telerik team
answered on 30 Oct 2018, 09:44 AM
Hi Simon,

The following Binding hides/shows the entire List based on a data field value, i.e. whether there are any children :
Property path   |   Expression
Visible         |   = IIf(Fields.Children.Count>0,True,False)

Important!
The data scope of the List where this Binding is set is the parent data item, i.e. the outer List. Hence, Object21 and Object22 are still displayed in Object12 as the latter *has* Children.
If you would like to hide Object21 and Object22 as they do not have Children, you may set the corresponding Binding to the Panel within the List, as the Panel data scope is the data scope of the List that contains it.

Regards,
Todor
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
Horia
Top achievements
Rank 1
Answers by
Stephan
Telerik team
Simon
Top achievements
Rank 1
Todor
Telerik team
Share this question
or