I have a Account Model in which I am using Email Address as Username
public class RegisterModel
{
[Required]
[Display(Name = \"Email Add
So, you are asking what this data type does not why isn't it validating, correct? Per the MSDN, DataType attributes are used primarily for formatting and not validation (which you have learned). What this attribute should do, is when using the Html.DisplayFor() helper, render the field as a clickable hyperlink.
@Html.DisplayFor(x=>x.UserName)
Renders
{0}
Additionally, as pointed out by Zhaph in the comments below, using it in the Html.EditorFor() will generate an HTML 5 email input, which looks something like this:
From MSDN
The following example uses the DataTypeAttribute to customize the display of EmailAddress data field of the customer table in the AdventureWorksLT database. The e-mail addresses are shown as hyperlinks instead of the simple text that ASP.NET Dynamic Data would have inferred from the intrinsic data type.