English 中文(简体)
mvc3 用户名的远距离验证进展障碍
原标题:mvc3 remote validation progress bar on username

I want to use small progress bar infront of UserName 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);
}
问题回答

暂无回答




相关问题
Using jquery to get a partial view and updating the UI

I need to render a partial view (returned from the controller) to show some customer summary details. This will need to happen when the user clicks on a button. In the the mean time the user can ...

MVC 2 / MVC 3 / MVC 4

MVC 2 我们可以轻松地创造领域。 现在,我的问题涉及nes地区(地区内)。

Asp.Net MVC 2 - Changing the PropertyValueRequired string

Using a resx file in the App_GlobalResources directory, I ve been able to change the default message for the PropertyValueInvalid string of the model validators. But it doesn t work to translate the ...

ASP.NET MVC 3 - What features do you want to see? [closed]

I know a bunch of people that are really enjoying the improvements that ASP.NET MVC 2 made over the first release. I have just started to migrate our MVC 1 project over and so far areas has totally ...

热门标签