I have items with children in content tree as below and has to be shown in the same page. We have created a Stronglytyped View of type ModelA
for the page:
public class ModelA
{
public IEnumerable<ModelA > item1 { get; set; }
public IEnumerable<ModelB> item2{ get; set; }
}
Content Tree is:
Item1(Based on Template A and Created ModelA to access)
---Children11(Based on Template A and Created ModelA to access))
---Children12(Based on Template A and Created ModelA to access))
Item2(Based on Template A and Created ModelA to access))
---Children21(Based on Template B and Created ModelB to access))
---Children22(Based on Template B and Created ModelB to access))
We are using GlassMapper to get data and so we have defined ModelA
for Children11
, Children12
and ModelB
for Children21
, Children22
.
I am able to get children for item1
but not for item2
has it is null
. Is it because glass mapper is not able to find them and map it of type ModelB
?
I think you'd have to use the SitecoreChildren attribute on the properties to make this work...