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
Having some issues returning/parsing the return value from the RelatedLinks picker. item.pageRelatedLinks is returning the following value:
"[\r\n {\r\n \"caption\": \"Laboramus\",\r\n \"link\": 1123,\r\n \"newWindow\": false,\r\n \"edit\": false,\r\n \"isInternal\": true,\r\n \"type\": \"internal\",\r\n \"title\": \"Laboramus\",\r\n \"internal\": 1123,\r\n \"internalName\": \"Home\",\r\n \"internalIcon\": \"icon-home\"\r\n },\r\n {\r\n \"caption\": \"Intellegam animal molestiae\",\r\n \"link\": 1123,\r\n \"newWindow\": false,\r\n \"edit\": false,\r\n \"isInternal\": true,\r\n \"type\": \"internal\",\r\n \"title\": \"Intellegam animal molestiae\",\r\n \"internal\": 1123,\r\n \"internalName\": \"Home\",\r\n \"internalIcon\": \"icon-home\"\r\n }\r\n]"
The error with the below code states that 'isInternal' is not valid on type 'char'. On inspection, itemLink is "91".
Anyone any idea what is going wrong?
@foreach (var itemLink in item.pageRelatedLinks) { var linkUrl = (bool)itemLink.isInternal ? umbraco.library.NiceUrl(itemLink.Value<int>("internal")) : itemLink.link; var linkTarget = (bool)itemLink.newWindow ? "_blank" : null; <li><a href="@linkUrl" target="@linkTarget">@itemLink.caption</a></li> }
In case anyone else has this issue, this approach worked:
<ul> @foreach (dynamic item in JsonConvert.DeserializeObject(startNode.GetPropertyValue<string>("relatedLinks"))) { var linkUrl = (bool)item.isInternal ? Library.NodeById(@item.link).Url : item.link; var linkTarget = (bool)item.newWindow ? "_blank" : null; <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li> } </ul>
As detailed in Amirs post here
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Related Links
Having some issues returning/parsing the return value from the RelatedLinks picker. item.pageRelatedLinks is returning the following value:
The error with the below code states that 'isInternal' is not valid on type 'char'. On inspection, itemLink is "91".
Anyone any idea what is going wrong?
In case anyone else has this issue, this approach worked:
As detailed in Amirs post here
is working on a reply...