Is it possible to set type of input generated by TextBoxFor

前端 未结 4 1859
感情败类
感情败类 2021-02-12 03:42

I am using ASP.NET MVC 3 TextBoxFor in a form and would like to use type=\"email\" for easier input for at least some mobile devices but cannot find how to set it using TextBoxF

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-12 04:19

    Try adding [DataType( DataType.EmailAddress )] to the email property.

    [DataType( DataType.EmailAddress )]
    [StringLength(50)]
    public string Email { get; set; }
    

提交回复
热议问题