asp.net mvc - c# mvc textboxfor for multiple strings -
is possible have html.textboxfor html helper bound multiple strings? mean, have 1 input user can either sign in username or email. basically, following:
@html.textboxfor(x => x.username || x.email) // not work obviously, // got idea model.cs
... [required] public string username {get; set;} [required] public string email {get; set;} // btw, required attribute may cause problem therefore can // remove or ignore them while validating
don't bind textbox either property. handle code in action check against username , email.
if you're creating login form won't updating either property, there's no need bind.
Comments
Post a Comment