When working with hierarchical content types, you will need to get child content items for a specific parent. The following procedure describes how to achieve this using the dynamic module manager. For more information about the sample code snippets used in the article, see Example: Retrieve and create child items.
Before getting children of an item, we recommend to check if the item has any children. You do this in the following way:
To retrieve the child items of a parent item, you must get a collection of all child items that are one level under a parent, in the following way:
Hierarchical content types are working with a Sitefinity CMS workflow. If you have not defined any workflow, Sitefinity CMS uses the default one. The items are represented in two versions – Master and Live. When you create a new content item, Sitefinity CMS first creates the master version. After you publish the item, Sitefinity CMS creates the live version, which is a copy of the master one. Only the live versions of items are visible on the frontend. When you want to modify an item, you change the master version. When you publish the changes, a new live version is created and displayed on the frontend.
Because of this the hierarchy is persisted only by the master items. When you perform operations such as getting all of the children of an item or setting a parent, you use the master versions. Use the following examples to work with different versions of content items:
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important