开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜