我有一个Asp.Net MVC项目。我正在尝试为editorFor进行电子邮件验证。html helper的电子邮件验证 - ASP.Net
基于我所研究的方法[在这个答案:How to apply input which has a type email to to HTML Helper in Asp.net MVC3 Razor更多...]做到这一点是这样的:
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control", @dir="ltr", @type = "email"} })
唯一的问题是,这可以确保我有此模式: name @ gmail 但它不确定是否有。在@ - [[email protected]]之后某处的电子邮件地址。
关于我能做什么的任何想法? 感谢
你读过[this](http://stackoverflow.com/a/16690164/1663001)回复你关联的帖子吗? – DavidG
删除'new {@type =“email”}''并将'[EmailAddress]'属性添加到你的属性 –