public ActionResult CheckForDuplication(string UserName)
{
SqlConnection con = new SqlConnection(s);
SqlCommand cmd = new SqlCommand("Sp_CheckForDuplication", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", UserName);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
return Json("Sorry UserName not aviable", JsonRequestBehavior.AllowGet);
}
else
{
return Json(true, JsonRequestBehavior.AllowGet);
}
and in my model
[Required(ErrorMessage = "*")]
[StringLength(20, MinimumLength = 4, ErrorMessage = "Must be at least 4 characters long.")]
[Remote("CheckForDuplication", "OutLet", HttpMethod = "POST", ErrorMessage = "User name already exists. Please enter a different user name.")]
so when i m trying to execiute it it wont hits the method ..any help please
thanks and regards