I have an ASP.NET page that utilizes an ASP.NET CalenderExtender inside an Ajax UpdatePanel. A user can choose from several different languages. I need the Calendar to change with the updated Culture info without the entire page refreshing.
The culture info is being updated for the thread
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture)
And
EnableScriptGlobalization="true"
EnableScriptLocalization="true"
What else do I need to do?
Vaguely related to what I'm working on now... a couple of suggestions that might help: - I also do this just after doing "Thread.CurrentThread.CurrentCulture = ..."
I personnally build my CalendarExtender dynamically, but the important line is the Format:
and elsewhere I've got this static method:
as we have clients in the US and in the UK, the date must work in either mm/dd/yyyy or dd/mm/yyyy (and we use the masked edit extender hence the use of two digits for days and months).
On the client side of things, in javascript I can access the format string like this (getter), but I don't know if it can be set, I've not tried. It might help you in your "no postback" scenario:
Note that you might have to change this format again, for example, I'm using the jQuery UI datepicker, and MM is interpreted as Month Full Name, whereas in C# MM is a two-digit month. Worse, yyyy in C# is four-digit year, but for jQuery datepicker, yy is the four-digit year, so yyyy would end up with 20152015. You could do a dirty: