TESTI call it ...">

Partial view errors of asp.net mvc fixed

My partial view called _myTestView.cshtml

<div style="border:1px solid red;"> TEST </div> 

I call it that

 <div> @Html.RenderPartial("_myTestView"); </div> 

I get the following runtime error

Compiler Error Message: CS1502: The best overloaded method matches 'System.Web.WebPages.WebPageExecutingBase.Write (System.Web.WebPages.HelperResult)' has some invalid arguments

What am I doing wrong?

+4
source share
2 answers

You are not in a code block, so do not use .RenderPartial

Just use .Partial and get rid of ;

 <div> @Html.Partial("_myTestView") </div> 
+2
source
+1
source

Source: https://habr.com/ru/post/1382586/


All Articles