If you're dealing with dynamicNode such as using:

var someNode = new umbraco.MacroEngines.DynamicNode(1046) in your template, it instantiates a DynamicNode like you'd expect, but then it doesn't function as a dynamic object
because it wasn't initialised as a dynamic variable [dynamic someNode = new umbraco.MacroEngines.DynamicNode(1046)]

Added a method to DynamicNode called NodeById which returns a new DynamicNode with the ID you pass, so you can call it off @Model
e.g. var item = @Model.NodeById(1046) will still function as a dynamic, even though it was defined as var
This commit is contained in:
agrath@gmail.com
2011-01-27 14:49:56 -13:00
parent 28b48b187a
commit 3ab4944e5e

View File

@@ -297,7 +297,10 @@ namespace umbraco.MacroEngines
return this;
}
}
public DynamicNode NodeById(int Id)
{
return new DynamicNode(Id);
}
public int Id
{
get { if (n == null) return 0; return n.Id; }