First I should start by explaining the context of the problem. This is my content structure:
When I am in the Master Swedish page, I am running a razor script that is supposed to go the the Master Node, search all blog posts and show the ones that have the swedishChoice property set to true, like so:
What I get is an error saying that the script could not be loaded and it happens because I put the @n.GetProperty("swedishChoice") in the if statement. Shoulndn't this work?
I suspect this has something to do with the way I am accessing the Master Node. Is there a better way? I tried accessing the BlogPost nodes by creating this variable:
Problem with GetProperty
Hello!
First I should start by explaining the context of the problem. This is my content structure:
When I am in the Master Swedish page, I am running a razor script that is supposed to go the the Master Node, search all blog posts and show the ones that have the swedishChoice property set to true, like so:
What I get is an error saying that the script could not be loaded and it happens because I put the @n.GetProperty("swedishChoice") in the if statement. Shoulndn't this work?
I suspect this has something to do with the way I am accessing the Master Node. Is there a better way? I tried accessing the BlogPost nodes by creating this variable:
but I get the same type of error.
Thank you for your time.
Have you tried ?
And I think you should use:
GetPropertyValue
instead ofGetProperty
Hi Joao
you should either use
or
so your code must be like below:
I've also added .Items to Descendants(BlogPost") to get the return type
List<DynamicNode>
Using GetPropertyValue worked well! Also having the number 1 in between " " also did the trick. Thanks.
is working on a reply...