Use related content items with widgets
Built-in widgets for modules supporting related data have a property RelatedDataDefinition of type RelatedDataDefinition. RelatedDataDefinition is a definition class containing all information needed to display related data items, including:
- RelatedItemId, RelatedItemType, RelatedItemProviderName, and RelatedFieldName properties, which give information about the related item.
- RelationTypeToDisplay, which determines the relation type of the items that will be displayed - child or parent. By default, child items are displayed. To display parent items, set the value of the property to Parent.
- RelatedItemSource,which defines the type of source for resolving the related item. This property is of type RelatedItemSource and can have the following values:
- DataItemContainer - the related item is resolved from the current DataItemContainer.
- URL - the related item is resolved from the URL.
- NoAutomaticBinding - the related item is not automatically resolved. You must set RelatedItemId and RelatedItemProviderName manually.
The following code is an example of NewsView item with configured RelatedDataDefinition to display child items: