C# attribute to check whether one date is earlier than the other

前端 未结 6 1700
孤独总比滥情好
孤独总比滥情好 2021-02-07 15:05

I have a ViewModel for my MVC4 Prject containing two DateTime properties:

[Required]
[DataType(DataType.Date)]
public DateTime RentDate { get; set; }

[Required]         


        
6条回答
  •  眼角桃花
    2021-02-07 15:50

    Nothing like that exists in the framework. A common similar attribute is the RequiredIf. It is described in this post.

    RequiredIf Conditional Validation Attribute

提交回复
热议问题