The call is ambiguous between the following methods or properties: 'Umbraco.Web.UmbracoHelper.Media(params int[])' and 'Umbraco.Web.UmbracoHelper.Media(params string[])'
on this code:
@{
var hours = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("hoursList");
foreach (var item in hours) // ERROR ON THIS LINE
{
if (item.HasValue("heading"))
{
<tr><td class="tablespace"></td></tr>
<tr><td class="tablehead" colspan="2">@item.GetPropertyValue("heading")</td></tr>
<tr><td class="tableleft">@item.GetPropertyValue("days")</td><td class="tableright">@item.GetPropertyValue("hours")</td></tr>
}
else
{
<tr><td class="tableleft">@item.GetPropertyValue("days")</td><td class="tableright">@item.GetPropertyValue("hours")</td></tr>
}
}
}
This block works perfectly on other document types. I am out of ideas as to what is going wrong in this specific instance.
I'm not sure you've included the correct code. The error suggests that you're passing something into the media method which the compiler doesn't know if it is a string array or an int array. The code like look like Ùmbraco.Media(myVariable)`.
I'm not sure you've included the correct code. The error suggests that you're passing something into the media method which the compiler doesn't know if it is a string array or an int array. The code like look like Ùmbraco.Media(myVariable)`.
Ya, this is why I was so confused by this error - the code I included is correct.
Also, are you using the core property value converters or something else to allow you to do GetPropertyValue<IEnumerable<IPublishedContent>>. It sounds like an issue with the converter.
Also, are you using the core property value converters or something else to allow you to do GetPropertyValue<>
I am not using the core property value converters package. I forgot to mention that "hoursList" is using Nested Content.
I ended up deleting and re-creating the document type from scratch (and keeping the same template), and that has seemed to fix this problem. It's still a mystery what caused that error.
Ok, now I really don't get it. This problem is coming back on a completely separate and new template created from scratch, that also implements Nested Content. I just updated N.C. to the newest version as well.
I am now getting the same "The call is ambiguous..." error on this code:
(MasterLayout.cshtml has not been modified)
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Newtonsoft.Json.Linq;
@using Newtonsoft.Json;
@{
Layout = "MasterLayout.cshtml"; //ERROR HERE
}
@section Head
Model.Content - "The call is ambiguous..." error
I am receiving the error:
on this code:
This block works perfectly on other document types. I am out of ideas as to what is going wrong in this specific instance.
Any ideas?
Thanks for the help!
I'm not sure you've included the correct code. The error suggests that you're passing something into the media method which the compiler doesn't know if it is a string array or an int array. The code like look like Ùmbraco.Media(myVariable)`.
Ya, this is why I was so confused by this error - the code I included is correct.
Check "hours" dosent contain anything NULL, or not of iPublishedContent, before you loop through it :-)
Also, are you using the core property value converters or something else to allow you to do
GetPropertyValue<IEnumerable<IPublishedContent>>
. It sounds like an issue with the converter.I am not using the core property value converters package. I forgot to mention that "hoursList" is using Nested Content.
I ended up deleting and re-creating the document type from scratch (and keeping the same template), and that has seemed to fix this problem. It's still a mystery what caused that error.
Thank you for the brainstorming!
Ok, now I really don't get it. This problem is coming back on a completely separate and new template created from scratch, that also implements Nested Content. I just updated N.C. to the newest version as well.
I am now getting the same "The call is ambiguous..." error on this code: (MasterLayout.cshtml has not been modified)
Stack trace:
What am I missing or doing wrong? I have used this same code on multiple other templates successfully.
I know that is line 5, but have you stepped through in the debugger to confirm the error happens on this line? Sometimes it is reported incorrectly.
Does
MasterLayout.cshtml
inheritUmbracoTemplatePage
as well?is working on a reply...