Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Starting with this code in a regular template (.master file):
<umbraco:Macro runat="server" language="cshtml">
@foreach(var node in Model.Children) {
@RenderPage("~/macroScripts/partial.cshtml", node)
}
</.umbraco:Macro>
Even though I am passing each child node through, the Model property in the partial is still the parent node, not the child node.
Nevermind, I should read the wiki, then I would have found this:
http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/@renderpage-with-args
Don't forget you can also use Razor helpers (@helpers) with Umbraco - just put your helper code in App_Code.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How can render a Razor macro from an inline Razor macro (in a loop)?
Starting with this code in a regular template (.master file):
<umbraco:Macro runat="server" language="cshtml">
@foreach(var node in Model.Children) {
@RenderPage("~/macroScripts/partial.cshtml", node)
}
</.umbraco:Macro>
Even though I am passing each child node through, the Model property in the partial is still the parent node, not the child node.
Nevermind, I should read the wiki, then I would have found this:
http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/@renderpage-with-args
Don't forget you can also use Razor helpers (@helpers) with Umbraco - just put your helper code in App_Code.
is working on a reply...