Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Remote validation on two field Email and CNIC.Remote Validation work proper but when i clik on submit button form not post.When i remove remote validation on both of fileds form post the data.

Model

Public class VMModel
{
Remote("Function","Controller",ErrorMessage = "The CNIC already exists")]
public string CNIC { get; set; }
[Remote("Function2", "Controller", ErrorMessage = "The Email already exists")]
public string Email { get; set; }
}


Controller

public JsonResult Function2(string Email)
{
bool IsExist = true;
if (Membership.GetUser(Email) != null)
{
IsExist = false;
}

return Json(IsExist, JsonRequestBehavior.AllowGet);
}
public JsonResult Function(string CNIC)
{
bool IsExist = true;
if (GetUserByCNIC(CNIC) != null)
{
IsExist = false;
}

return Json(IsExist, JsonRequestBehavior.AllowGet);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900