@alex since i don't know the type of the children. i need to have some thing generic. This is what the dynamic contains at the moment. Can you elaborate why is it unpredictable and/or dangerous.
@John. Count() doesn't work either.... Since it's a dynamic... :-(
DynamicPublishedContentList does not contain a definition for 'Any'
Why is this error.
Clean install; mvc4 startup project in VS 2013.
install umbraco (nuget)
install MVC 5 (nuget)
fails on:
home.Children.Any() in a razor.
managed to get it working with...
var helper = home.Children as DynamicPublishedContentList; } @if (helper.Any())
why is this and how can it be solved?
kind regards,
Hi Frans,
Try to use strongly typed objects, DynamicPublishedContentList is dangerous and unpredictable.
Thanks
Have you tried? .Children.Count() > 0?
Hi thanks for the reply.
@alex since i don't know the type of the children. i need to have some thing generic. This is what the dynamic contains at the moment. Can you elaborate why is it unpredictable and/or dangerous.
@John. Count() doesn't work either.... Since it's a dynamic... :-(
All nodes are the same type, why you don't know what type ?
DocType is different.
So what kind of typed objects should i use.
Is there a reason why the items are dynamic instead of a strongly typed list?
Have you try like this one?
Thanks Jivan..
Only problem is that intellisense still doesn't show the any extention. Do i need to add a using in order to get this working?
kind regards,
Could you try this one? @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
I had this already... but that doesn't work.
{
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using Umbraco.Core.Models @using Umbraco.Web.Models
@{ IPublishedContent home = CurrentPage.Site();
}
is working on a reply...