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