Hi guys I'm messing around with a super simple script.
I got a variable with a fallback value, but when i try to change the value with a value from a mediaPicker property it gives me an error. I've done this kind of changing 100 of times but i just cant figure this one out?!?
I that that the problem is that when you are picking an image with the media picker you just get the id of the item in the media section, e.g 1058. So as you said the variable started as a text string and then change it to an integer to get the id of the picture that you are choosen with the media picker.
Change variable value in partial view
Hi guys
I'm messing around with a super simple script.
I got a variable with a fallback value, but when i try to change the value with a value from a mediaPicker property it gives me an error. I've done this kind of changing 100 of times but i just cant figure this one out?!?
Error message:
Cannot implicitly convert type 'Umbraco.Web.Models.DynamicPublishedContent' to 'string'
Line 12: image = Umbraco.Media(CurrentPage.topImage);
Hi Mads,
Could you perhaps use this approach. So if the media picker doesn't have a value then you take the default image.
or
Hope this helps,
/Dennis
Hi Dennis
Thanks for reply - but the problem is that the value is used as an inline property for a div.
I think the problem is that I start with an variable as a text string and then change it to Umbraco value - or something like that :P
Maybe there is a better practice for this problem :D
Hi Mads,
I that that the problem is that when you are picking an image with the media picker you just get the id of the item in the media section, e.g 1058. So as you said the variable started as a text string and then change it to an integer to get the id of the picture that you are choosen with the media picker.
/Dennis
Well i know that is should look like this :D
is working on a reply...