加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – asp.net mvc局部视图错误输出

发布时间:2020-12-16 09:50:08 所属栏目:asp.Net 来源:网络整理
导读:我的部分视图,名为_myTestView.cshtml div style="border:1px solid red;"TEST/div 我这样称呼它 div @Html.RenderPartial("_myTestView");/div 我得到以下运行时错误 Compiler Error Message: CS1502: The best overloaded method match for ‘System.Web.W
我的部分视图,名为_myTestView.cshtml

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

TEST

</div>

我这样称呼它

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

我得到以下运行时错误

Compiler Error Message: CS1502: The best overloaded method match for
‘System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)’
has some invalid arguments

我究竟做错了什么?

解决方法

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

只需使用.Partial并摆脱;

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读