umbraco.MacroEngines.DynamicNodeList does not contain a definition for [anything]
Hi guys,
I can't seem to get to the items below a level. I keep getting:
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'GetChildrenAsList'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Down'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Children'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Descendants'
My website is structured like:
Website
-homepage
--banners
--Categories
So when I'm on the homepage I want using Razor to loop round the banners. I've tried a loads of different ways but can't seem to get it working. Even just writing out the number of items under banners throws one of the above errors:
Model.HomepageCategories would retrieve a property with the alias of HomepageCategories on the currentpage (which doesn't exist) and a property does not have children....
If you have a single document type for the items you wish to select, then you could use:
var banners = Model.Descendants("aliasOfBannerItems");
However the XPath method will probably be more efficient for you
umbraco.MacroEngines.DynamicNodeList does not contain a definition for [anything]
Hi guys,
I can't seem to get to the items below a level. I keep getting:
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'GetChildrenAsList'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Down'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Children'
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Descendants'
My website is structured like:
Website
-homepage
--banners
--Categories
So when I'm on the homepage I want using Razor to loop round the banners. I've tried a loads of different ways but can't seem to get it working. Even just writing out the number of items under banners throws one of the above errors:
dynamic banners = Model.HomepageCategories.GetChildrenAsList();
@banners.Count()
Above would throw:
'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'GetChildrenAsList'
Also stuff like this blows up:
dynamic banners = Model.Descendants("HomepageCategories").Children;
or
dynamic banners = Model.Descendants("HomepageCategories").Children();
I'm running 6.3.1, and I've install TeaCommerce but haven't done anything with it.
Thanks
Rob
Hi Rob,
What exactly is HomepageCategories, a property (picker) on your home page document type or a document type alias?
Jeavon
It's a Document Type and under it are Category Document types which are what I'm trying to get to from the Homepage.
Ok, I think probably the XPath method would be most appropriate for this, try:
This worked! Thanks.
Why could I not look over something like:
foreach (var item in Model.HomepageCategories.GetChildrenAsList)
Great,
Model.HomepageCategories would retrieve a property with the alias of HomepageCategories on the currentpage (which doesn't exist) and a property does not have children....
If you have a single document type for the items you wish to select, then you could use:
However the XPath method will probably be more efficient for you
Thanks,
Jeavon
is working on a reply...