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
Hi, 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
Try
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.
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Ambiguous call error when fetching an image url in the server
Hi, 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
Try
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.
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.