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
This small piece of code works fine on my own machine in debug mode but crashes on the server:
var defaultIconId = CurrentPage.GetPropertyValue("defaultIcon");
var defaultIconObject = Umbraco.Media(defaultIconId);
The second line gives the following error:
The call is ambiguous between the following methods or properties: 'Umbraco.Web.UmbracoHelper.Media(System.Collections.Generic.IEnumerable
Any clues? I may try setting the fetched "defaultIconId" to string but would like to know what is the approved way.
Changing the top line to
var defaultIconId = CurrentPage.GetPropertyValue
did not help either. Still works fine on the local machine
var defaultIconId = CurrentPage.GetPropertyValue<string>("defaultIcon");
Sorry, I did try that. It didn't work.
Then I tried ToString(). I think that did work but I have another issue with the database not refreshing and being unable to access the back office, so there was a null value.
So I think I'll close the thread for now.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted