Reputation: 29668
I've come to an MVC3 project I wrote just a week ago which has stopped working and is throwing the following error:
Error 10
The call is ambiguous between the following methods or properties: 'System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(System.Web.Mvc.HtmlHelper, string)' and 'System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(System.Web.Mvc.HtmlHelper, string)
'
What is the reason for this? I haven't changed anything in project recently for it to bork. The code I call it in looks like this:
<div class="page-body">
@if(!String.IsNullOrWhiteSpace(ViewBag.ErrorMessage)) {
// Output error message
Html.Raw(ViewBag.ErrorMessage);
} else {
// Render upload form
Html.RenderPartial("_UploadForm");
}
</div>
Upvotes: 0
Views: 388
Reputation: 11191
You are missing @ symbols front of your Html.Raw because teh method reutrns a string back hence requires the @symbol
For your knowledge taken from MSDN : The Razor syntax @ operator HTML-encodes text before rendering it to the HTTP response. This causes the text to be displayed as regular text in the web page instead of being interpreted as HTML markup.
Please use it this way
<div class="page-body">
@if(!String.IsNullOrWhiteSpace(ViewBag.ErrorMessage)) {
@Html.Raw(ViewBag.ErrorMessage);
} else {
// Render upload form
Html.RenderPartial("_UploadForm");
}
</div>
Upvotes: 1