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'm trying to set NiceUrl to a link I have but the answeres i've found on here and google don't seem to work. here's my code can anybody point it out to my why it doesn't work:
<a href="@item.destinationUrl.NiceUrl">@item.Name</a>
i've also tried different versions such as:
<a href="@umbraco.library.NiceUrl(@item.destinationUrl)">@item.Name</a>
amongts other. any takers?
Hi,
Normally you don't need to use NiceUrl in Razor, you can just use the .Url property of your dynamic node. Ex: @item.Url
But in your case I'm guessing you want to get the URL of a content picked with a content picker? In that case I would do something like this:
var destination = Library.NodeById(item.destinationUrl);<a href="@destination.Url">@destination.Name</a>
Hope this helps,Tom
Thanks Tom that worked. had to work around it a bit but still worked. thanks.
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
Can't get NiceUrl to work
hi, i'm trying to set NiceUrl to a link I have but the answeres i've found on here and google don't seem to work. here's my code can anybody point it out to my why it doesn't work:
<a href="@item.destinationUrl.NiceUrl">@item.Name</a>
i've also tried different versions such as:
<a href="@umbraco.library.NiceUrl(@item.destinationUrl)">@item.Name</a>
amongts other. any takers?
Hi,
Normally you don't need to use NiceUrl in Razor, you can just use the .Url property of your dynamic node. Ex: @item.Url
But in your case I'm guessing you want to get the URL of a content picked with a content picker? In that case I would do something like this:
Hope this helps,
Tom
Thanks Tom that worked. had to work around it a bit but still worked. thanks.
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.