CompareValidator, Dates, switching Thread culture, need help urgently

Discussion in 'ASP .Net' started by gauthier, Jun 30, 2005.

  1. gauthier

    gauthier Guest

    Hi,

    I'm developing a web application available in multiple languages.

    When we switch language (via a drop down list), we switch the culture of the
    current thread:

    System.Threading.Thread.CurrentThread.CurrentUICulture = SelectedCulture;

    the problem is that I use a CompareValidator on dates:

    codebehind:
    dateCompareValidator.ValueToCompare = DateTime.Today.ToShortDateString();


    frontcode:
    <asp:CompareValidator id="dateCompareValidator" runat="server"
    ControlToValidate="dbFooterStatusEndDate" Type="Date"
    Operator="GreaterThanEqual" display="none"/>

    if the current thread culture is not the same than the application server
    culture, then I got exception (I've switched to english culture but my
    server is a french server)



    Page : http://localhost/Nemo.WebApplication/supplier/search/default.aspx
    Méthode : System.Web
    Message d'erreur : La valeur '6/29/2005' de la propriété ValueToCompare de
    'dateCompareValidator' ne peut pas être convertie en type 'Date'.
    Nom de l'exception : HttpException
    Stack Trace : at
    System.Web.UI.WebControls.CompareValidator.ControlPropertiesValid()
    at System.Web.UI.WebControls.BaseValidator.get_PropertiesValid()
    at System.Web.UI.WebControls.BaseValidator.Render(HtmlTextWriter writer)
    at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
    .....


    What is the solution to this problem?

    Thanks alot.

    Nicolas
    gauthier, Jun 30, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jorge EA
    Replies:
    1
    Views:
    564
    Peter Blum
    Sep 4, 2004
  2. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    859
    Rob Schieber
    Sep 30, 2005
  3. THaskell

    CompareValidator with Dates

    THaskell, Oct 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    7,900
    Mr Newbie
    Oct 7, 2005
  4. tshad
    Replies:
    4
    Views:
    30,068
    natty_dread
    Aug 7, 2007
  5. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    192
    Mark Schupp
    Aug 9, 2004
Loading...

Share This Page