MVC 4 BeginForm重载中的命名参数

现在,他谁不能被命名。

我看到BeginForm具有以下签名的方法的重载

(扩展名)MvcForm HtmlHelper.BeginForm(字符串actionName,字符串ControllerName,FormMethod方法)

named-arguments在调用时使用类似

@using (Html.BeginForm(actionName:"Index", controllerName:"Home", FormMethod.Get))

但是,我不断收到这样的错误:

CS1738: Named argument specifications must appear after all fixed arguments have been specified

有什么想法我要去哪里错吗?

谢谢。

道格拉斯

您还需要为最后一个参数指定参数名称:

@using (Html.BeginForm(actionName:"Index", controllerName:"Home", method:FormMethod.Get))
//                                                                  ↖ parameter name

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章