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 have a multi-node picker, it allows me to pick up to 3 nodes
<umbraco:Item field="venuesPicker" runat="server" /> this gives me, 1702, 1712, 1743
I would like to use this to iterate through and get the title so for example the aliasTitle, Sometimes there will be 3 other times 1 will be picked.
Thanks,
Hi Rocoeh,
If you have uComponents installed (or are using Umbraco 4.8 beta) there's a method in uQuery that'll return a collection of nodes from a CSV string:
<ul> @{ string venuesCsv = uQuery.GetCurrentNode().GetProperty<string>("venuesPicker"); foreach (Node pickedNode in uQuery.GetNodesByCSV(venuesCsv)) { <li>@(pickedNode.GetProperty<string>("title"))</li> } } </ul>
HTH,
Hendy
thanks that did not work put this directly in my template
<ul> <umbraco:Macro runat="server" language="cshtml"> @{ string venuesCsv = uQuery.GetCurrentNode().GetProperty<string>("venuesPicker"); foreach (Node pickedNode in uQuery.GetNodesByCSV(venuesCsv)) { <li>@(pickedNode.GetProperty<string>("title"))</li> } }</umbraco:Macro> </ul>
I get a macro load error
Have you referenced the namespaces ? (if using uComponents you'll need: using uComponents.Core; and using uComponents.Core.uQueryExtensions; )
no luck either am trying the razor version
<umbraco:Macro runat="server" language="cshtml"><ul> @{ foreach (var x in Model.venuesPicker) { <li>@x.id</li>}</ul></umbraco:Macro>
but get the same error.
You can reference namspaces in inline Razor like this:
<umbraco:Macro runat="server" language="cshtml">@using uComponents.Core;@using uComponents.Core.uQueryExtensions;
@{ var h1 = uQuery.GetCurrentNode().GetProperty<string>("pageTitleH1"); <h1>@h1</h1>}
</umbraco:Macro>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Iterating through ultimate picker
Hi,
I have a multi-node picker, it allows me to pick up to 3 nodes
<umbraco:Item field="venuesPicker" runat="server" /> this gives me, 1702, 1712, 1743
I would like to use this to iterate through and get the title so for example the aliasTitle, Sometimes there will be 3 other times 1 will be picked.
Thanks,
Hi Rocoeh,
If you have uComponents installed (or are using Umbraco 4.8 beta) there's a method in uQuery that'll return a collection of nodes from a CSV string:
HTH,
Hendy
Hi,
thanks that did not work put this directly in my template
<ul>
<umbraco:Macro runat="server" language="cshtml">
@{
string venuesCsv = uQuery.GetCurrentNode().GetProperty<string>("venuesPicker");
foreach (Node pickedNode in uQuery.GetNodesByCSV(venuesCsv))
{
<li>@(pickedNode.GetProperty<string>("title"))</li>
}
}
</umbraco:Macro>
</ul>
I get a macro load error
Hi Rocoeh,
Have you referenced the namespaces ? (if using uComponents you'll need: using uComponents.Core; and using uComponents.Core.uQueryExtensions; )
no luck either am trying the razor version
<umbraco:Macro runat="server" language="cshtml">
<ul>
@{
foreach (var x in Model.venuesPicker) {
<li>@x.id</li>
}
</ul>
</umbraco:Macro>
but get the same error.
You can reference namspaces in inline Razor like this:
<umbraco:Macro runat="server" language="cshtml">
@using uComponents.Core;
@using uComponents.Core.uQueryExtensions;
@{
var h1 = uQuery.GetCurrentNode().GetProperty<string>("pageTitleH1");
<h1>@h1</h1>
}
</umbraco:Macro>
is working on a reply...