List in List in List .. etc

4 posts, 0 answers
  1. Horia
    Horia avatar
    1 posts
    Member since:
    Mar 2011

    Posted 17 Mar 2011 Link to this post


    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:

    * Object2.Name
    ** Object3.Name
    ** Object3.Name
    * Object2.Name
    ** Object3.Name
    ** Object3.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.
  2. Stephan
    Stephan avatar
    12 posts

    Posted 18 Mar 2011 Link to this post

    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.

    the Telerik team
  3. Simon
    Simon avatar
    85 posts
    Member since:
    Sep 2018

    Posted 25 Oct 2018 in reply to Stephan Link to this post

    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?



  4. Todor
    Todor avatar
    516 posts

    Posted 30 Oct 2018 Link to this post

    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)

    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.

    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
Back to Top