locked
Validating UK Date RRS feed

  • Question

  • User-667608363 posted
    US Date  format   is MM/DD/YYYY
    UK Date format   is DD/MM/YYYY

    <asp:CompareValidator id="CV1"  ErrorMessage="Invalid Date" runat="server" controltovalidate="PaymentFrom" Operator="DataTypeCheck" Type = Date />

    Problem is that the control above still think in US format, therefore causing my date as an Invalid Date
    I want UK validation
    Please help Thanks

    <asp:CompareValidator id="CV1" errormessage="Invalid Date" runat="server" controltovalidate="PaymentFrom" operator="DataTypeCheck" type="Date"></asp:CompareValidator>

    <asp:CompareValidator id="CV1" errormessage="Invalid Date" runat="server" controltovalidate="PaymentFrom" operator="DataTypeCheck" type="Date"></asp:CompareValidator>
    Monday, May 1, 2006 1:54 AM

All replies

  • User-837620913 posted
    The CompareValidator uses the System.Threading.Thread.CurrentThread.CurrentUICulture to determine how to compare things like dates.  You can set the CurrentUICulture in the Page_Load event.

    Check out this article:

    http://www.devx.com/dotnet/Article/6999
    Monday, May 1, 2006 10:53 PM