My latest project was being done in ASP.NET MVC3 and I needed to do some date validation that was beyond what was available out-of-the-box. I Googled around the inter-webs for awhile and couldn’t find anything that met my needs so I decided to create my own set of extensions…and while I was at create my NuGet package and CodePlex project.
For some reason the validation attributes available for the Date data type are non-existence in MVC. You can compare to another model field, but that only checks for equality. You can use regular expressions, which is not fun, and you can only compare against static values, or you can create your own validation attributes…which is the route I chose.
I created custom validation attributes that I found that I needed in my projects and packed some up to make available to the masses.
EzValidation contains validation for:
The source Code is available on CodePlex.
The package can be installed via NuGet. “package-install EzValidation"
Keith is a Senior Software Engineer with Falafel Software. He has been developing software since 1999 specializing in web-based solutions primarily using the Microsoft stack. He has been a Microsoft MVP in ASP.NET since 2012.
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.