电子邮件验证比较表格不返回错误信息

时间:2019-07-19 04:26:25

标签: c# asp.net validation email asp.net-mvc-5

import styled from "styled-components";
import Icon from "./Icon";

const StyledIcon = styled(Icon)`
  margin: 0 20px;
  svg {
    fill: ${({ fill }) => fill || "#03a9f3"};
    height: ${({ dimension }) => dimension || "50px"};
    width: ${({ dimension }) => dimension || "50px"};
  }
`;

export default StyledIcon;

1 个答案:

答案 0 :(得分:0)

使用 nameof

[RegularExpression(@"[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}")]
public string Email { get; set; }

[Compare (nameof(Email), ErrorMessage = "The Email and Confirm Email fields do not match.")]    
public string EmailConfirm { get; set; }