Date Format Recognition in ASP.NET Controls

To make an ASP.NET control validator recognize an alternate date format such as DD/MM/YYYY, set the culture at the page level with a command like this:

Page.Culture = “en-AU”;

This will set the validators for Australian English, and the following validator will work correctly:

1
2
3
<asp:CompareValidator ID="cvStartDate" runat="server" ControlToValidate="txtStartDate" 
ErrorMessage="The From Date should be in the format DD/MM/YYYY." Operator="DataTypeCheck"
Type="Date">*</asp:CompareValidator>