by StoneJunction
6. January 2012 23:58
I am just getting up to speed on MVC3 with Razor and when creating a partial view ("_TestPartial.cshtml") and including it on another page through with:
@Html.RenderPartial("_TestPartial")
I got the error:
CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments
Looking at RenderPartial it returns a void. Internally it writes directly to the response. A quick razor syntax change to:
@{ Html.RenderPartial("_TestPartial"); }
sorted the problem. Now for the interesting problem of getting MVC partials to render on classic aspx webpages.