That's what the Model says.
1[Display (Name ="User name")]2[Required (errormessage ="please fill in {0}")]3[Stringlength ( -, Minimumlength =6, errormessage ="{0} length must be greater than {2} bit less than {1} bits")]4[System.Web.Mvc.Remote ("Checksellernick","Login", errormessage ="user account already exists")]
public string Loginno {get; set;}
Controller 里面这样写的
1[OutputCache (location = outputcachelocation.none, Nostore =true)]//Clear Cache2 PublicJsonresult Checksellernick (stringLoginno)3 { 4 //bool exists = _userservice.loginnoexist (Loginno);5 BOOLexists = Loginno.equals ("111111") ?true:false;6 returnJson (exists, jsonrequestbehavior.allowget);7}
That's what the View says.
1 New " Register_input " " - " , }) 2 3 class="register_error"> @Html. validationmessagefor (o = O. Loginno) </div>
Mvc.remote Verify that the user name is duplicated