Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have structure setup like this in my site:
Home - Testimonials - Testimonial 1 - Testimonial 2 - Testimonial 3
The testimonials document type is purely there to act as a container so I can enable list view to look at all the testimonials and manage them.
On the homepage I am then trying to populate an object with all the testimonials but I am unable. Any variation of @Model.Content.Children or @Model.Content.Children.Where(...) returns nothing and in debugger I get message:
"Children could not be evaluated"
I have also tried .Descendants(). Same thing. What am I missing here?
It works with:
var testimonials = @CurrentPage.Descendants("Testimonial");
I don't understand why dynamic query works and strongly typed one does not. Is it something to do with the cache?
Can anyone explain this for my own understanding and learning?
Turns out its an EF issue with lazy loading. Adding .ToList() makes it viewable in the debugger. Not sure why my code wasn't working originally. I have got it working with strongly typed query now.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted