Date in textboxes changing format
- by AWinters
I have an application (asp.net 3.5) that support 4 different languages. Along with other cultural changes, the date formats must match the current culture on out reporting pages.
We set the date formats of each of the textboxes like:
string date = DateTime.Today.ToString("d"); //returns the date portion only
textbox1.Text = date;
textbox2.Text = date;
etc...
When the user selects Spanish or British English the format should be dd/mm/yyyy. However, then I navigate to the page it displays in mm/dd/yyyy. After a postback it then displays dd/mm/yyyy. After another postback it switches to the mm/dd/yyyy format and on and on.
I have debugged through this and I see that the culture is correct for the application and the date formats are returned to me correctly, yet when it displays, it displays incorrectly.
Has anyone ever seen this or know what is happening?