I have a simple partial view which returns (renders) a list of synonyms of a given word. Then I’d like to use this partial view inside another view and I use @Html.RenderPartial("SynonymFinder", new { word = "Something" }) inside my view. But I get this error:
CS1502: The best overloaded method match for ‘System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)’ has some invalid arguments
This is the simplest scenario. I even removed the parameters and used @Html.RenderPartial("SynonymFinder"), but still the same problem. What’s wrong?
In MVC 3 you should use:
Note that the 2nd parameter is of type
ViewDataDictionary. If you don’t pass it explicitly like that, the helper will use the overload that takes anobjectas the 2nd parameter and uses it as a Model instead of as route values.