I have an Asp.Net MVC project. I am trying to make an email validation for an editorFor.
Based on what i've researched the way [in this answer: How to apply input which has a type email to to HTML Helper in Asp.net MVC3 Razor and more...] to do it is like this:
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control", @dir="ltr", @type = "email"} })
The only issue is that this makes sure that i have this pattern: name@gmail but it doesn't make sure that there is a . in the email address somewhere after the @ - [[email protected]].
any ideas about what i can do? thanks
new { @type = "email" }
and add the[EmailAddress]
attribute to you property