Validating Dates d/mm/yyyy

P

Patrick.O.Ige

I'm using this CompareValidator to validate dates but my default its
mm/dd/yyyy
<asp:CompareValidator ControlToValidate="DOB" Display="Dynamic"
Text="Invalid birth date!" Operator="DataTypeCheck"
Type="Date" Runat="Server" ID="DOBcompval" />
Is there a way i can change it to dd/mm/yyyy of course if not using
RegularExpressionValidator
Any ideas
 
K

Karl Seguin

The validators use the current culture and the system's configuration in the
Regions settings to determine what the proper format is. You can change the
culture at the page or application level via:

<%@ Page Culture="es-MX" UICulture="es-MX" %>
which is "Spanish - Mexico"

OR

<configuration><system.web>
<globalization culture="es-MX" uiCulture="es-MX" />
</system.web></configuration>

Of course, the regularexpression is always an option, or you can validate on
the server using Date.ParseExact.

karl
 
P

Patrick.O.Ige

Thx Karl.
Didn't just think of changing the glob culture..
That could have done the trick faster than using regex :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,050
Members
48,769
Latest member
Clifft

Latest Threads

Top