ASP.NET MVC3 @ Html.RenderPartial抛出CS1502错误 [英] ASP.NET MVC3 @Html.RenderPartial is throwing CS1502 Error

查看:194
本文介绍了ASP.NET MVC3 @ Html.RenderPartial抛出CS1502错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立我的动态网页类的MVC3应用程序,并试图呈现一个部分,我收到以下错误:

I'm building an MVC3 app for my dynamic web class, and while attempting to render a partial, I get the following error:

CS1502:为了获得最佳重载方法匹配'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)'有一些无效参数

CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

现在,我执行code是这样的:

Now, the code I'm executing is this:

<div>
    <h2>Shipping Address</h2>
    @Html.RenderPartial("_AddressPartial");
</div>

现在,我GOOGLE了这一点,从我所看到的,答案是所有旧版本的MVC和使用的&lt;%%>风格语法和得到System.IO错误,而不是对System.Web错误我得到。我没有听从他们的建议,但并有和没有分号,这没有什么区别,我还是得到了YSOD每一次尝试。任何想法?

Now, I've googled this, and from what I've seen, the answers are all for older versions of MVC and used the <% %> style syntax and got System.IO errors rather than the System.Web error I'm getting. I did follow their advice though and try with and without the semicolon, which made no difference as I still got the YSOD each time. Any ideas?

推荐答案

这可能只是因为的RenderPartial 没有的收益的东西。无论是尝试:

This might just be because RenderPartial doesn't return anything. Try either:

@Html.Partial("_AddressPartial")

@{ Html.RenderPartial("_AddressPartial"); }

这篇关于ASP.NET MVC3 @ Html.RenderPartial抛出CS1502错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆