On my frontpage I am using this Link Picker https://our.umbraco.org/projects/backoffice-extensions/link-picker/ and it works fin.
My problem is that on my frontpage the user can insert a external link and I would like to use that link on at subpage.
But I cant seem to get the right output.
In my PartialViewMacroPage I have tried this:
@{
var brandLink1 = Model.Content.AncestorOrSelf(1).GetPropertyValue("brandLink1");
}
<p>@brandLink1</p>
That gives me an error.
It's becaurse I'm getting the link-input from my frontpage and not from the pages that I'm currently at.
Does that make any sense?
Just had a go with the package myself. I think some propertyvalueconverters are missing in order to make it possible for your to use it strongly typed.
Dynamically it works by writing @CurrentPage.links.url - Which in your case should be @CurrentPage.brandLink1.url
The problem is that I cant use CurrentPage, because the link-information comes from another template(frontpage) and I want to use the link that the user insertet on a subpage.
That's why I thought, that if I used this code I would get the information from my frontpage
@{
var brandLink1 = Model.Content.AncestorOrSelf(1).GetPropertyValue("brandLink1");
}
link Picker output
Hi
On my frontpage I am using this Link Picker https://our.umbraco.org/projects/backoffice-extensions/link-picker/ and it works fin. My problem is that on my frontpage the user can insert a external link and I would like to use that link on at subpage. But I cant seem to get the right output. In my PartialViewMacroPage I have tried this:
But the output is this:
and I would like it to be just: http://centurion.dk/
It's probably the GetPropertyValue that is wrong, but I dont know what to put insted :-)
Hi Kate
At a first glance I'm wodnering if you have you tried to simply just write @brandLink1.url - Does that work?
/Jan
That gives me an error. It's becaurse I'm getting the link-input from my frontpage and not from the pages that I'm currently at. Does that make any sense?
Hi Kate
Just had a go with the package myself. I think some propertyvalueconverters are missing in order to make it possible for your to use it strongly typed.
Dynamically it works by writing @CurrentPage.links.url - Which in your case should be @CurrentPage.brandLink1.url
/Jan
The problem is that I cant use CurrentPage, because the link-information comes from another template(frontpage) and I want to use the link that the user insertet on a subpage.
That's why I thought, that if I used this code I would get the information from my frontpage
Hi Kate
Ah yes, sorry about that - But you can actually use CurrentPage to fetch it from a subpage as well.
You just need to write it like this @CurrentPage.AncestorOrSelf(1).brandLink1.url
Hope this helps.
/Jan
Try
Jan: Sorry, it still doesen't work
Søren: it works :-). Thanks. I'm really grateful
Do you know where I can read more about this
Check this out https://our.umbraco.org/documentation/Reference/Templating/Mvc/views :)
is working on a reply...