Looking for some help in accessing siblings properties. I've get a variable with the sibling I need to access but on trying to get the property value it just returns null. In VS if I use a brake point it does show that the sibling is logged and it holds two properties. It just wont store the properties in my variable.
In the code below if im in the correct node then i can get the document link but if I try access from the sibling no such look. What am i missing?
Thanks
Phil
var documentLink = CurrentSection.HasProperty("documentLink") ? CurrentSection.GetPropertyValue<IPublishedContent>("documentLink") : null;
var siblings = Model.Content.Siblings().FirstOrDefault(x => "footerLinks".InvariantEquals(x.DocumentTypeAlias));
var siblingsDocumentLink = siblings.HasProperty("documentLink") ? CurrentSection.GetPropertyValue<IPublishedContent>("documentLink") : null;
Just looking at your code, you are checking that the siblings variable has the property "documentLink", but you are then trying to retrieve it from CurrentSelection. Should that not be siblings instead?
So this:
var siblingsDocumentLink = siblings.HasProperty("documentLink") ? siblings.GetPropertyValue<IPublishedContent>("documentLink") : null;
instead of this:
var siblingsDocumentLink = siblings.HasProperty("documentLink") ? CurrentSection.GetPropertyValue<IPublishedContent>("documentLink") : null;
Accessing Sibling Properties
Hi,
Looking for some help in accessing siblings properties. I've get a variable with the sibling I need to access but on trying to get the property value it just returns null. In VS if I use a brake point it does show that the sibling is logged and it holds two properties. It just wont store the properties in my variable.
In the code below if im in the correct node then i can get the document link but if I try access from the sibling no such look. What am i missing?
Thanks
Phil
Hey Phil,
Just looking at your code, you are checking that the
siblings
variable has the property "documentLink", but you are then trying to retrieve it fromCurrentSelection
. Should that not besiblings
instead?So this:
instead of this:
Nik
is working on a reply...