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

About the author

Steve French Steve is the President and lead developer of Digital Tool Factory and currently provides all technical development for DTF. Digital Tool Factory has provided behind the scenes technical muscle to the Atlanta design community since 2002.Google+ Profile

 

Written By Steve French

 

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

  1. NAGARAJ M says:

    Thanks forur artical i used this ,..

Leave a Reply





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