2
是否有可能有一个Html.TextBoxFor
html helper绑定到多个字符串?我的意思是说,你有一个输入,用户可以用用户名或电子邮件登录。基本上,类似如下:c#mvc textboxfor多个字符串
@Html.TextBoxFor(x => x.UserName || x.Email) // this does not work obviously,
// but you got the idea
model.cs
...
[Required]
public string UserName {get; set;}
[Required]
public string Email {get; set;}
// btw, the required attribute may cause a problem therefore I can
// remove or ignore them while validating
嗯这不是我一直在寻找,但谢谢你的提示:) – Shaokan