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
I can iterate through a Multi-URL Picker when the field is hard coded like this:
<ul>@foreach (var link in Model.mainContentLinks.urlpicker){ <li><a href="@link.url"@Html.Raw(link.newwindow == "True" ? "target=\"_blank\"" : "")>@link.linktitle</a></li>}</ul>
But, I'm passing the Multi-URL Picker field as a propertyTypeAlias macro parameter (called "linkField"), and I'm struggling to get it to work.
I've tried:
@foreach (var link in Model.GetProperty(Parameter.linkField).urlpicker)
or
@foreach (var link in Library.ToDynamicXml(Model.GetProperty(Parameter.linkField)).urlpicker)
What am I missing?
Cheers,
Mike
Also tried Library.ToDynamicXml(Model.GetProperty(Parameter.linkField).Value).urlpicker - still no joy...
Could it be related to this old issue: http://ucomponents.codeplex.com/workitem/13465.
Guess you're trying to do the same things as in here: http://our.umbraco.org/forum/developers/razor/19984-Razor-variable-property#comment75914.
Jeroen
Yeah, that's where I started, but couldn't get it to work.
In the end I gave up, and used the "Related Links with Media" data type instead, which seems to work fine.
M
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Using uComponents Multi-URL Picker with Razor and a Macro Parameter
I can iterate through a Multi-URL Picker when the field is hard coded like this:
<ul>
@foreach (var link in Model.mainContentLinks.urlpicker)
{
<li><a href="@link.url"@Html.Raw(link.newwindow == "True" ? "target=\"_blank\"" : "")>@link.linktitle</a></li>
}
</ul>
But, I'm passing the Multi-URL Picker field as a propertyTypeAlias macro parameter (called "linkField"), and I'm struggling to get it to work.
I've tried:
@foreach (var link in Model.GetProperty(Parameter.linkField).urlpicker)
or
@foreach (var link in Library.ToDynamicXml(Model.GetProperty(Parameter.linkField)).urlpicker)
What am I missing?
Cheers,
Mike
Also tried Library.ToDynamicXml(Model.GetProperty(Parameter.linkField).Value).urlpicker - still no joy...
Could it be related to this old issue: http://ucomponents.codeplex.com/workitem/13465.
Guess you're trying to do the same things as in here: http://our.umbraco.org/forum/developers/razor/19984-Razor-variable-property#comment75914.
Jeroen
Yeah, that's where I started, but couldn't get it to work.
In the end I gave up, and used the "Related Links with Media" data type instead, which seems to work fine.
M
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.