我有以下型号:
public class FormularModel
{
[Required]
public string Position { get; set; }
[Required]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Required]
public string Webcode { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
必需的验证工作正常.但是当我尝试使用DataType时它没有反应.
这是我的电子邮件控件的剃刀代码:
@Html.TextBoxFor
(model => model.Email,
new { @style = "width: 175px;", @class = "txtField" }
) *
Run Code Online (Sandbox Code Playgroud)
那么,有人知道答案吗?
TIA