Hey so I am running 4.9 and have ucomponents v5.0 beta. I have a number of nodes all with a urlpicker property these nodes are in turn selected on a page using a multiple node picker.
I am really difficulty in getting the value of the URL Picker here, the documentation seems to stop just short of my understanding and so I am a bit lost.
When i output the value of my UrlPickerProperty I get type uComponents.DataTypes.UrlPicker.Dto.UrlPickerState but really not sure where to go from here. Any help would be really great, I have tried @n.BannerLink.Url but that errors. I have tried deserialising the value but it is epxecting a string (of course).
I must doing something stupid but I dont know what.
I think @n.BannerLink.Url should work. But here is how you can deserialize it to get autocomplete, etc. This uses GetPropertyValue as that always returns a string.
UrlPickerState state = UrlPickerState.Deserialize(Model.GetPropertyValue("pieceLink")); if (state != null) { var targetAttr = state.NewWindow ? " target=\"blank\"" : ""; <a href="@state.Url" title="@state.Title"@targetAttr>@state.Title</a> }
UrlPickerState in Razor
Hey so I am running 4.9 and have ucomponents v5.0 beta. I have a number of nodes all with a urlpicker property these nodes are in turn selected on a page using a multiple node picker.
I am really difficulty in getting the value of the URL Picker here, the documentation seems to stop just short of my understanding and so I am a bit lost.
When i output the value of my UrlPickerProperty I get type uComponents.DataTypes.UrlPicker.Dto.UrlPickerState but really not sure where to go from here. Any help would be really great, I have tried @n.BannerLink.Url but that errors. I have tried deserialising the value but it is epxecting a string (of course).
I must doing something stupid but I dont know what.
L
Hi,
I think @n.BannerLink.Url should work. But here is how you can deserialize it to get autocomplete, etc. This uses GetPropertyValue as that always returns a string.
HTH,
Tom
Hi,
depending on the type of link you picked you may have to check the urlpicker mode to proceed:
HTH
Matthias
Hi guys
Thanks so much for your answers thanks for the tips about getting serialise to work Tom!
I have marked Matthias's repsonse as the answer as this is what I have implemented in my code and it works fine.
Cheers
L
is working on a reply...