How to get value of field with "Pages" form control with Kentico API?

Targutai Yesugei asked on August 23, 2017 10:28

I tried to use GetValue(), but it returns null, so I think that this page list is stored somewhere else.

Thank you in advance.

Recent Answers


Joe Souch answered on August 23, 2017 15:49 (last edited on December 10, 2019 02:31)

Hi,

If you're asking how to show a page type field on the page tab then I use a static text widget and the following Macro:

{% CurrentDocument["Description"] |(identity)GlobalAdministrator%}

Joe

1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on August 23, 2017 16:11 (last edited on August 23, 2017 16:17)

I see you are talking about "Related Pages". The field is empty because this control replicates Related pages functionality, It just lets you do the same thing on the form tab that you could do on properties/related pages tab. All data is stored in CMS_RelationshipName and CMS_Relationship tables. You can use Document Query for that

// nodeGuid  - is the Node Guid of your document

// Get documents related to specified document
var documents = DocumentHelper.GetDocuments("CMS.MenuItem")
                              .OnSite("CorporateSite")
                              .InRelationWith(nodeGuid, "IsRelatedTo");
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.