If you specify the related documents in the Relationships dialog of the Content module, you can display them using one of the following controls:
All of them have three properties that need to be used in order to display only related documents (besides other properties, such as SelectNodesPath, SelectNodesClassName, etc.):
• | RelationshipWithNodeGUID / Main document - NodeGUID value of the main document - it's typically the currently displayed document. |
• | RelationshipName / Relationship name - code name of the relationship. |
• | RelatedNodeIsOnTheLeftSide / Main document is on the left side - indicates if the main document is on the left or right side of the relationship. |
Example
The following example shows how to display news items related to the product.
1. | Go to CMS Desk -> Content and click /Products/LCD Displays/Acer AL1511s, click Properties -> Related docs. |
2. | Add two relationships with name is related to with documents /News/Your first news and /News/Your second news.![]() |
3. | Edit the Products.aspx template and add a CMSRepeater control. |
4. | Set the following control properties: - Path: /% (we want to display related news items from the whole website) - ClassNames: cms.news - TransformationName: cms.news.preview - RelationshipName: choose Display documents related to the current document, check the box Main document is on the left side and choose relationship name is related to. Save the changes. |
5. | Click /Products/LCD Displays/Acer AL1511s and click Live site. You will see the list of related news items below the product displayed using the cms.news.preview transformation:![]() |
Page url: http://devnet.kentico.com/docs/controls/index.html?displaying_related_documents.htm