G
gauthier
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
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