| method | description |
|---|---|
| [StringLength(200)] | 입력문자길이 지정 |
| [DataType(DataType.Date)] | 데이타타입 지정 |
| [DisplayFormat(DataFormatString = “{0:yyyy-MM-dd HH:mm}”, ApplyFormatInEditMode = false)] | 시간 형식 지정 |
| [Display(Name = “작성자”)] | 레벨 명 지정 |
| [DefaultValue(true)] | 디폴트 값 지정 하기, 폼있는 클래스는 다시정의 해야함, |
| public decimal Amount { get; set;} | Money Type |
| public System.DateTime REGI_DATE {get; set;} | datetime |
| public Nullable<System.DateTime> MODI_DATE {get;set;} | Null 허용 |
샘플 1

|
1 2 3 4 5 6 |
[Display(Name = "출발일")] [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] [DataType(DataType.Date)] public string DEPARTUREDATE { get; set; } |
Valid error message
|
1 2 3 4 5 6 7 8 9 10 11 12 |
if (ModelState.IsValid) { //go on as normal } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y=>y.Count>0) .ToList(); } |