Date Validation in ASP.NET

I don't think ASP.NET uses the most intiative validator for data type validation. I find every time I need to add date validation to a form, I have to go back and look up which validator I need to use (compare validator? range validator?) and what fields to set.

So, for reference, here is what you need to do:

  • Use a Compare validator

  • Set the ControlToValidate to point to the date textbox

  • Set the Type to "Date"

  • Set the Operator to "DataTypeCheck"


  • That's all there is to it!

    0 comments:

    Post a Comment