I am having an issue using dynamic nodes which have been added to a DynamicNodeList. Essentially after adding a dynamic node to the list, I cannot access the properties dynamically. I am using Umbraco version 4.7.4. Here is an example macroscript file which can reproduce the problem.
@using umbraco.MacroEngines @inherits umbraco.MacroEngines.DynamicNodeContext
<!-- TEST 1, access to .noSeach propery works lovely :) --> <ul> <li>My variable type is .. "@Model.GetType()"</li> <li>Current page is .. "@Model.Id"</li> <li>Here is a property retireved through dynamic .. "@Model.noSearch"</li> </ul>
@{ var newNode = new DynamicNode(Model.Id); }
<!-- TEST 2, access to .noSeach propery throws an error message :( --> <ul> <li>My variable type is .. "@newNode.GetType()"</li> <li>Current page is .. "@newNode.Id"</li> @* uncommenting this line throws an error.. why? <li>Here is a property retireved through dynamic .. "@newNode.noSearch"</li> *@ </ul>
Perpahs I am incorrectly using or misunderstanding when I can use Dyanmic property, is the 'dynamicness' only available on Model?
When is a DynamicNode dynamic?
I am having an issue using dynamic nodes which have been added to a DynamicNodeList. Essentially after adding a dynamic node to the list, I cannot access the properties dynamically. I am using Umbraco version 4.7.4. Here is an example macroscript file which can reproduce the problem.
Perpahs I am incorrectly using or misunderstanding when I can use Dyanmic property, is the 'dynamicness' only available on Model?
Doh! - seems like I dont know my dynamics!
Solved by using the dynamic keyword instead of var.. so
is working on a reply...