I have been trying to get the nice url and node name from nodes selected in the Ultimate Picker property on a page and can't seem to get it right in Umbraco v6.1.5.
I am able to output the node ids as strings but not pass them into NiceUrl() to output. Here's what I have now to output the id strings:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<ul class="row">
@foreach(var link in CurrentPage.footerLinks.Split(',')) {
This simply outputs a list of node ids of course. I have tried to use @Umbraco.NodeById(link.ToString()).NiceUrl() and variations of that to pass into the href but get compilation errors each time.
Attempting to get nice url from Ultimate Picker
I have been trying to get the nice url and node name from nodes selected in the Ultimate Picker property on a page and can't seem to get it right in Umbraco v6.1.5.
I am able to output the node ids as strings but not pass them into NiceUrl() to output. Here's what I have now to output the id strings:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
<ul class="row">
@foreach(var link in CurrentPage.footerLinks.Split(',')) {
<li class="large-3 columns"><a href="#">@link.ToString()</a></li>
}
</ul>
This simply outputs a list of node ids of course. I have tried to use @Umbraco.NodeById(link.ToString()).NiceUrl() and variations of that to pass into the href but get compilation errors each time.
Thanks in advance guys.
Hi Jake,
Essentially, I think you only need to use
Umbraco.Content(link)
but take a look at the Mvc dynamic example for ultimate picker hereYou might also be interested in this package which takes away the need to split every time you need to output.
Jeavon
Hi Jake,
just use
@Umbraco.TypedContent(link).Url
NiceUrl is obsolete.so your code would be
Thanks guys, Ali's solution worked.
Hi Jake,
Glad it worked, it would be great to mark it as solved so other people can easily find the answer.
Cheers
Ali
is working on a reply...