양식 검증시 오류 메시지를 표시하려고합니다. 나는 모델 클래스에 주석 속성이 있습니다데이터 유형이 int 일 때 값 ''이 (가) 유효하지 않습니다.
[Required(ErrorMessage="The number attribute is required")]
public int Level { get; set; }
그것은 작동하지 않습니다,하지만 난 string
에 데이터 형식을 변경할 때, 주석의 오류 메시지가 표시됩니다. int
이 지원되지 않는다는 의미입니까?
[int는 값 유형이므로 절대 null이 아닙니다.] (http://stackoverflow.com/questions/5057267/what-is-the-difference-between-a-reference-type-and-value-type-in -c) – Liam