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
Hi,
I know I can get all by type and then list them out but I am trying to get a specif fileld from a specif node. So if my node is 1703 and my field is shortIntro how do I return this in another template?
Hi rocoeh.
You can make a dynamic object like this:
dynamic node = new umbraco.MacroEngines.DynamicNode(1703);
Then you can get all properties like this :
<h2>@node.shortIntro </h2>
You can also make a DynamicNode then get properties like this :
DynamicNode node = new umbraco.MacroEngines.DynamicNode(1703);<h2>@node.GetPropertyValue("shortIntro")</h2>
Cheers.
Thanks for your reply, my code
<umbraco:Macro runat="server" language="cshtml">@{DynamicNode node = new umbraco.MacroEngines.DynamicNode(1703);<h2>@node.GetPropertyValue("shortIntro")</h2> }</umbraco:Macro>
The error is
Error loading MacroEngine script (file: )
Add this:
@using umbraco.MacroEngines;
like this:
<umbraco:Macro runat="server" language="cshtml">@using umbraco.MacroEngines; @{DynamicNode node = new DynamicNode(1703);<h2>@node.GetPropertyValue("shortIntro")</h2> }</umbraco:Macro>
Or just add umbraco.MacroEngines also for first DynamicNode :
<umbraco:Macro runat="server" language="cshtml">@{ umbraco.MacroEngines.DynamicNode node = new umbraco.MacroEngines.DynamicNode(1703); <h2>@node.GetPropertyValue("shortIntro")</h2>}</umbraco:Macro>
first one worked a treat, many thanks!
Hi Rocoeh,
Can you mark gilad's post as the answer, so that others facing the same problem might find it easily?
Many thanks!
Cheers,
Michael.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting fields from specific conent node
Hi,
I know I can get all by type and then list them out but I am trying to get a specif fileld from a specif node. So if my node is 1703 and my field is shortIntro how do I return this in another template?
Hi rocoeh.
You can make a dynamic object like this:
Then you can get all properties like this :
<h2>@node.shortIntro </h2>
You can also make a DynamicNode then get properties like this :
Cheers.
Thanks for your reply, my code
<umbraco:Macro runat="server" language="cshtml">
@{
DynamicNode node = new umbraco.MacroEngines.DynamicNode(1703);
<h2>@node.GetPropertyValue("shortIntro")</h2>
}
</umbraco:Macro>
The error is
Error loading MacroEngine script (file: )
Hi,
Add this:
@using umbraco.MacroEngines;
like this:
Or just add umbraco.MacroEngines also for first DynamicNode :
first one worked a treat, many thanks!
Hi Rocoeh,
Can you mark gilad's post as the answer, so that others facing the same problem might find it easily?
Many thanks!
Cheers,
Michael.
is working on a reply...