How to apply input which has a type email to to HTML Helper in Asp.net MVC3 Razor

前端 未结 3 1845
情深已故
情深已故 2021-02-13 16:26

How to apply input which has a type email to HTML Helper in Asp.net MVC3 Razor. For example:

 

        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-13 17:03

    Use Dataanotations at Model :

    [Required]
    [DataType(DataType.EmailAddress, ErrorMessage = "Invalid Email Address")]
    public string EmailAddress
    {
        get;
        set;
    
    }
    

提交回复
热议问题