小编Hyd*_*dro的帖子

使用DataAnnotations比较输入到数据库的电子邮件地址

我在MVC的模型中有一个类:

public class NewModel
{
    public bool AllComplexes { get; set; }
    public int UserID { get; set; }
    public int? RoleID { get; set; }
    public int ComplexID { get; set; }

    [Required(ErrorMessage = "Please enter a user name."), StringLength(50)]
    public string Username { get; set; }

    [Required(ErrorMessage = "Please enter Password"), StringLength(100, ErrorMessage = "Password cannot be longer than 100 characters")]
    public string Password { get; set; }

    [Compare("Password", ErrorMessage = "Passwords do not match")]
    [Required(ErrorMessage = "Please …
Run Code Online (Sandbox Code Playgroud)

c# email asp.net-mvc modelstate data-annotations

3
推荐指数
1
解决办法
2548
查看次数

标签 统计

asp.net-mvc ×1

c# ×1

data-annotations ×1

email ×1

modelstate ×1