开发者

mvc3 remote validation progress bar on username

开发者 https://www.devze.com 2023-01-29 09:06 出处:网络
I want to use small progress bar infront of U开发者_如何学CserName on the cshtml page. How do I do that?

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);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消