FormView DateTime bug??

K

Karl-Inge Reknes

Hello,

I have a formview control with an objectdatasource to control update and
insert operations.
One field is a DateTime. After click Edit follow by Update, day and month
changes.

Example: 01.12.1990 becomes 12.01.1990 after Update.

What are I’m doing wrong?
 
P

Phillip Williams

Hi Karl-Inge,

I would check that the Regional and Language Options setting on the server
where the data are stored matches the format used in TextBox that displays
the date on teh webform. You can force the textbox to display the server
format, for exmaple,
<asp:TextBox Text='<%# Bind("ord_date", "{0:d/M/yyyy}") %>

I recreated your issue by
1- adding on the aspx Page directive Culture="Auto" UICulture="Auto"
2- changed the browser language to [en-gb] whereas my server Regional and
Language Options are set to [en-us]
[This scenario is the equivalent of the browser is running on a PC different
from the server and the Regional and Language Options setting for displaying
the date is different on both (for example the server has the date for my
culture displayed as M/d/yyyy and on the client PC it was d/M/yyyy)]

3- I run the web application from my browser, the date is displayed as
M/d/yyyy (showing 9/1/2005) I save it and it comes back as 1/9/2005.
 
K

Karl-Inge Reknes

Thanks Phillip, this solved my problem

Karl-Inge

Phillip Williams said:
Hi Karl-Inge,

I would check that the Regional and Language Options setting on the server
where the data are stored matches the format used in TextBox that displays
the date on teh webform. You can force the textbox to display the server
format, for exmaple,
<asp:TextBox Text='<%# Bind("ord_date", "{0:d/M/yyyy}") %>

I recreated your issue by
1- adding on the aspx Page directive Culture="Auto" UICulture="Auto"
2- changed the browser language to [en-gb] whereas my server Regional and
Language Options are set to [en-us]
[This scenario is the equivalent of the browser is running on a PC different
from the server and the Regional and Language Options setting for displaying
the date is different on both (for example the server has the date for my
culture displayed as M/d/yyyy and on the client PC it was d/M/yyyy)]

3- I run the web application from my browser, the date is displayed as
M/d/yyyy (showing 9/1/2005) I save it and it comes back as 1/9/2005.


--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


Karl-Inge Reknes said:
Hello,

I have a formview control with an objectdatasource to control update and
insert operations.
One field is a DateTime. After click Edit follow by Update, day and month
changes.

Example: 01.12.1990 becomes 12.01.1990 after Update.

What are I’m doing wrong?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top