Orchard CMS - How to access the items in a container?

138 views Asked by At

It is necessary to get access to the members of the container element, how to implement it, tell me where to look. Zaklyuchaetsya essence in the following: there is a container in which to contain certain elements necessary to realize the possibility of getting the property values of these elements.

1

There are 1 answers

1
ub3rman123 On BEST ANSWER

To copy a previous answer I've made:

The actual content items aren't stored on ContainerPart. Instead, each contained item's CommonPart has a Container value that links to the container. You need to use LINQ to locate all ContentItems that have CommonPart.Container equal to your container.

int containerId = containerItem.Id;

var containedList = _contentManager
            .Query<CommonPart>()
            .Join<CommonPartRecord>()
            .Where(x => x.Container.Id == containerId)
            .List();