Hi,
I have a custom Page Type with some custom fields. And I'm having problems getting the values of those custom fields in my c# code.
Here's my code:
var docs = TreeProvider.SelectNodes().Types("myCustomType").Path("thePath");
StringBuilder s = new StringBuilder();
foreach (var d in docs){
s.AppendLine(d.DocumentName + " " + d.Value("myCustomField"));
}
When I print "s" out, I can see that the DocumentName is retrieved, but not "myCustomField".
According to all the documentation I've read, this SHOULD WORK ... but it isn't :(. Does anybody have any ideas? Thank you.
Hi Rita,
Try using the overload of SelectNodes that takes the class name as a parameter:
https://devnet.kentico.com/docs/10_0/api/html/M_CMS_DocumentEngine_TreeProvider_SelectNodes_3.htm
And with each TreeNode object, try using the GetValue method.
Mike
Awesome, thank you, that worked!
... Kentico drives me a little crazy sometimes!
Good news, I'm glad this helped.
Please, sign in to be able to submit a new answer.