Validating date range in asp net
This quick post shows how to validate two date fields by comparing their values.
When there is two date fields in a page like From Date & To Date , then generally arises a requirement to show a message that From Date can not be greater than To Date or, something like that.
OR as a programmer, you should have implemented this very common date validation which is "End Date should not be less than Start Date".
Finally, we create an adapter to transform the HTML5 attributes into a format that our custom function can understand.
It sounds like a lot of work; but I assure you once you get started you will find it relatively straightforward.
Then, I am going to implement an IClient Validatable interface. I am going to override Is Valid implement simple logic.
This intercface only needs one method, the one that returns validation rules collection. To do that, I need to have access to two things, current value which is passed into this method, and the other property value that I need to compare this value to.
I am working on my previous application so most of the code is the same.