Ajax.BeginForm
有11个不同的声明。
在第一种情况下,它是有效的,因为您使用了这个:
Ajax.BeginForm(string actionName, string controllerName, AjaxOptions options)
但第二种情况是,你使用这个,试图在
object routeValues
参数:
Ajax.BeginForm(string actionName, object routeValues, AjaxOptions options, object htmlAttributes)
最后,您要使用的声明是:
Ajax.BeginForm(string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
使用
null
值,例如:
Ajax.BeginForm("SaveCandidateLanguage", "Candidate", null,
new AjaxOptions
{
HttpMethod = "Post",
OnBegin = "onBeginFormValidation",
OnSuccess = "onSaveCandidateLanguageSuccess"
},
new
{
id = "addEditCandidateLanguageForm",
novalidate = "novalidate"
}))
以及
?length="9"
因为“Candidate”包含9个字符,长度是字符串的唯一属性