DynamicNode passed to helper results in ability to access node properties
I have a problem that involves MNTP which returns CSV data and ahelper that renders node data. When the DynamicNode is passed into the helper I lose access to the properties and not sure why as I can step into the script and access properties fine before it passed in?
@{
var panels = Model._SidebarContent.Split(',');
foreach (var panel in panels)
{
var node = Model.NodeById(panel);
string nodeType = node.NodeTypeAlias;
switch (nodeType)
{
case "ExampleNodeType":
// Properties accessible via dot notation here e.g. Node.Myproperty
@ExampleRenderNodeTypeHelper(node)
break;
}
}
}
@helper ExampleRenderNodeTypeHelper(dynamic contentNode) {
// Properties no longer accessible since contentNode is considered an 'object' type now?
@contentNode.MyProperty
}
I'm using Umbraco 4.11.4 and not experienced this before. The only thing I am doing different to what I normally do is returning CSV data from the MNTP instead of XML.
I've already tried that and it results in the following:
'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'MyProperty' and no extension method 'MyProperty' accepting a first argument of type 'umbraco.MacroEngines.DynamicNode' could be found (are you missing a using directive or an assembly reference?)
DynamicNode passed to helper results in ability to access node properties
I have a problem that involves MNTP which returns CSV data and ahelper that renders node data. When the DynamicNode is passed into the helper I lose access to the properties and not sure why as I can step into the script and access properties fine before it passed in?
I'm using Umbraco 4.11.4 and not experienced this before. The only thing I am doing different to what I normally do is returning CSV data from the MNTP instead of XML.
Hi Simon,
Could it be that the parameter type should be a DynamicNode?
Cheers, Lee.
I've already tried that and it results in the following:
is working on a reply...