0
为MVC中的隐藏字段远程验证不会被解雇 型号:应用远程验证的隐藏字段中mvc4
[Remote("checker", "mycontroller", ErrorMessage = "Valid combination of phone and account number required.", HttpMethod = "Get")]
public string Validate_cart { get; set; }
查看:
@Html.HiddenFor(model => model.Validate_Paris)
也试过通过使用jquery设置值:
$("#Phone_Number").blur(function() {
$("#Validate_cart").val = "dummy"
});
使用jquery或通过模型的值设置,但验证不会被解雇。我使用fiddler进行了检查,没有任何时间调用该方法的呼叫。
方法
[HttpGet]
public bool checker(string Validate_cart)
{
try
{
bool isValid = //code to hit database to check the record
return !isValid;
}
catch (Exception)
{
throw;
}
}
它仍然不火的验证。 – Nikitesh
你能否用'checker'' action'代码更新你的文章? – Amila