Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc asp.net mvc部分视图出错_Asp.net Mvc_Razor_Partial Views - Fatal编程技术网

Asp.net mvc asp.net mvc部分视图出错

Asp.net mvc asp.net mvc部分视图出错,asp.net-mvc,razor,partial-views,Asp.net Mvc,Razor,Partial Views,我的部分视图,称为_myTestView.cshtml <div style="border:1px solid red;"> TEST </div> 试验 我这样称呼它 <div> @Html.RenderPartial("_myTestView"); </div> @RenderPartial(“_myTestView”); 我得到以下运行时错误 编译器错误消息:CS1502:的最佳重载方法匹配 'System.Web.We

我的部分视图,称为_myTestView.cshtml

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

TEST

</div>

试验
我这样称呼它

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

@RenderPartial(“_myTestView”);
我得到以下运行时错误

编译器错误消息:CS1502:的最佳重载方法匹配 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' 有一些无效的参数


我做错了什么

您不在代码块内,因此不使用
.RenderPartial

只需使用
.Partial
,然后去掉

<div>
  @Html.Partial("_myTestView")
</div>

@Html.Partial(“\u myTestView”)

将其放入代码块中

@{Html.RenderPartial("_myTestView");}
相关的