I've been working with Related Links today and for what ever reason the examples here weren't working for me. The examples use DynamicXML but I when I tried it the return data is always empty. Anyway below is my fix in case anyone gets stuck on this too.
Basically switch JArray for DynamicXML and fix the case on newwindow to newWindow.
var homeNode = Model.Content.AncestorOrSelf(1);
var columnOne = homeNode.GetPropertyValue<JArray>("columnOne");
@if (columnOne.Any())
{
<ul>
@foreach (dynamic item in columnOne)
{
var linkUrl = (item.type.Equals("internal")) ? Umbraco.NiceUrl(int.Parse(item.link)) : item.link;
var linkTarget = (item.newWindow.Equals("1")) ? " target=\"_blank\"" : string.Empty;
<li><a href="@linkUrl" @Html.Raw(linkTarget)>@item.title</a></li>
}
</ul>
}
Related Link
Hello
I've been working with Related Links today and for what ever reason the examples here weren't working for me. The examples use DynamicXML but I when I tried it the return data is always empty. Anyway below is my fix in case anyone gets stuck on this too.
Basically switch JArray for DynamicXML and fix the case on newwindow to newWindow.
Cheers
D
Hi David,
Did you find the samples in the documentation here?
Jeavon
Hi
This is the page I landed on from google link
D
Ah yes, that's the v4/v6 version. Always goto here for v7 property editor documentation.
Jeavon
is working on a reply...