How to fix the Asp.net CalendarExtender and CompareValidator to accept European date formats - Digital Tool Factory blog How to fix the Asp.net CalendarExtender and CompareValidator to accept European date formats - Digital Tool Factory blog

How to fix the Asp.net CalendarExtender and CompareValidator to accept European date formats

The Problem: You want to use the standard European Date Format, DD/MM/YYYY instead of the American Date Format MM/DD/YYYY.  You change the “Format” feature of the CalendarExtender to “DD/MM/YYYY”, but then the CompareValidator (which you’re using to ensure valid dates) calls out that you have entered an invalid date.

The Cause: The Compare Validator is expecting a different date format than it receives, and throws the error.   You will then notice that there is no “Format” attribute on the CompareValidator.

The Solution: Add the following line to the System.Web portion of your web.config file.

<globalization culture=”fr-FR”/>

That’s it!

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog

 

Written By Steve French

 

One response to “How to fix the Asp.net CalendarExtender and CompareValidator to accept European date formats”

Leave a Reply

Your email address will not be published. Required fields are marked *






Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.