c# - MVC4 - Model binding/mapping to parameter -
i've defined validation of 2 fields on model using remoteattribute. value each text-box sent server different named object in each instance. default want re-use same remote method numerous fields. how tell mvc bind/map primaryemail , secondaryemail email property on server-side?
tried , doesn't work: (email null)
model:
public class usermodel { [remote("emailcheck", "profile", httpmethod = "post", errormessage = "the email in use.")] public string primaryemail { get; set; } [remote("emailcheck", "profile", httpmethod = "post", errormessage = "the email in use.")] public string secondaryemail { get; set; } }
server side action:
public jsonresult emailcheck([bind(include = "primaryemail, secondaryemail")]string email) { return json(!_servicemanager.userprofileservice.isemailinuse(email)); }
json sent server:
primaryemail=abc%40yahoo.com secondaryemail=abc%40yahoo.com
Comments
Post a Comment