mvc3 remote validation progress bar on username
I want to use small progress bar infront of U开发者_如何学CserName on the cshtml page. How do I do that? Is there a way?
[Required(ErrorMessage = "{0} is required.")]
[Remote("IsUsernameAvalilable", "Validation")]
public string UserName { get; set; }
public JsonResult IsUsernameAvalilable(string userName)
{
if (!_repository.UserExists(userName))
return Json(true, JsonRequestBehavior.AllowGet);
return Json(String.Format(CultureInfo.InvariantCulture, "{0} is not available.", userName), JsonRequestBehavior.AllowGet);
}
精彩评论