This article describes how to get and set parent items in a hierarchy of content types.
For more information about the sample code snippets used in the article, see Example: Get and set parent items.
Use the CreateDataItem method to create a master version of an item. Then, you set its properties and publish it.
The item is published in Sitefinity CMS and its live version is created. When you call manager.SaveChanges() , the changes are persisted in the database. For more information about Sitefinity CMS lifecycle, see For developers: Content lifecycle.
After you create an artist, you can define an album for it. You achieve this by creating an album and publishing it through the lifecycle. You set the parent of the album.
The extension method SetParent(parentId, contentTypeName) assigns an album to an artist. You must pass the ID of the master parent item as a parameter. Do not leave child items without assigned them a parent, because they are persisted in the database, but are not visible. These items are only visible, if you remove the parent of their content type.
In addition to setting a parent for an item, use the following methods to work with hierarchical items:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2022 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity