views:

61

answers:

1

Someone must have written this before :-)

I need a validation attribute for date of birth that checks if the date is within a specific range - i.e. the user hasn't inputted a date that hasn't yet happened or is 150 years in the past.

Thanks for any pointers!

+1  A: 
LukeH
Thanks for your reply: I have tried your code above and received the following error "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type"
beebul
@beebul: Of course, sorry! A `Range` validator with constants wouldn't make much sense in this case, so I guess you'll need a custom validator. I'll edit my answer...
LukeH
Thanks Luke that works a treat. Shall be using that attribute regularly. Cheers!
beebul