469,609 Members | 1,682 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

CompareValidator, Dates, switching Thread culture, need help urgently

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.CurrentUICul ture = 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...h/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.Control PropertiesValid()
at System.Web.UI.WebControls.BaseValidator.get_Proper tiesValid()
at System.Web.UI.WebControls.BaseValidator.Render(Htm lTextWriter writer)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
.....
What is the solution to this problem?

Thanks alot.

Nicolas
Nov 19 '05 #1
0 1196

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Axel Dahmen | last post: by
1 post views Thread by Jorge EA | last post: by
8 posts views Thread by Max | last post: by
1 post views Thread by Lars Netzel | last post: by
3 posts views Thread by THaskell | last post: by
5 posts views Thread by Fabian | last post: by
2 posts views Thread by =?Utf-8?B?UGhpbCBKb2huc29u?= | last post: by
reply views Thread by =?Utf-8?B?VmFuY291dmVyTWlrZQ==?= | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.