I am getting the error loading razor script when try to access a custom property on "item":
error CS1061: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'someCustomProperty' and no extension method 'someCustomProperty'accepting a first argument of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference?)
Although when i debug and hover over the 'item" object i can see the property in the item.PropertiesAsList collection.
@{
var siteMapNode = model.NodeById(1046).GetChildrenAsList.Items.SingleOrDefault(s => s.Name == "en");
}
<
ulclass="floatL"id="mainNav">
@
foreach (DynamicNode item in siteMapNode.GetChildrenAsList)
{
var linkTitleImagesData = item.someCustomProperty; //
Cannot able to access custom properties
Hi there
I am getting the error loading razor script when try to access a custom property on "item":
error CS1061: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'someCustomProperty' and no extension method 'someCustomProperty'accepting a first argument of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference?)
Although when i debug and hover over the 'item" object i can see the property in the item.PropertiesAsList collection.
@{
var siteMapNode = model.NodeById(1046).GetChildrenAsList.Items.SingleOrDefault(s => s.Name == "en");
}
<
ul class="floatL" id="mainNav">
@
foreach (DynamicNode item in siteMapNode.GetChildrenAsList)
{
}
Any idea what am i missing?
Thanks
Just a guess, but try changing:
to
Basically you need the nodes to be a dynamic type to access custom properties directly.
is working on a reply...