working with the Nested content for the first time and its realy nice.
Easy to setup but when I want to get the value in my view its always null.
When I use the debugger of visual studio I can see that the value is null but my DataValue contains the data.
Am I missing something?
Below is my code:
@{
var companyRepo = Model.Content.AncestorOrSelf(1).Children.Where(c => c.IsVisible() && c.DocumentTypeAlias == "companyRepo").First();
var companies = companyRepo.Children.Where(c => c.IsVisible());
if(companies.Any())
{
<ul>
@foreach(var company in companies)
{
var packages = company.GetPropertyValue<IEnumerable<IPublishedContent>>("packages"); // Nested content property
<li>@company.Name</li>
}
</ul>
}
}
Value is always null
Hi,
working with the Nested content for the first time and its realy nice.
Easy to setup but when I want to get the value in my view its always null. When I use the debugger of visual studio I can see that the value is null but my DataValue contains the data.
Am I missing something?
Below is my code:
/Michaël
Ok something weird is going on.
If I restart my website, the value is correct. Why is this?
If I add a new item to my nested content, then its not automatically visible in the view. If I restart the app, then voila its there.
Anyone?
/Michaël
Ok I was using the ContentFinder where I used caching to store the values. After removing this, it works.
Caching was set to one day, maybe in the live environment I will set this to 10 minutes or something like that.
/Michaël
is working on a reply...