Re: Binding DateTimePicker
- From: "Bart Mermuys" <bmermuys.nospam@xxxxxxxxxxx>
- Date: Thu, 28 Dec 2006 12:06:28 GMT
Hi,
"John Stivenson" <JohnStivenson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A8617AA3-F6BD-4E37-A34C-5C73633CFB04@xxxxxxxxxxxxxxxx
A DateTimePicker control on my form is bound to a datetime field in a
DataTable.
When inserting a new record the default value for DateTimePicker is
today's
date.
However, unless the user changes this date it is not saved to database
(NULL
is stored instead of today's date). Text fields are stored normally.
A TextBox control has similar behavior: if the user leaves
a text box blank, NULL is sent to database, but if he enters
some text and then deletes it, an empty string is stored.
It seems that there is some "Modified" property for every control.
That right, well it's the Binding that has a (private) modified flag which
is triggered by the Control property-Changed event (eg.
TextChanged/ValueChanged). The value isn't persisted if the modified flag
hasn't been set.
In this case I want to store the current date instead of NULL.
How can I achive this?
Try to set default values on the DataSource.
If you're using NET2.0 you can use the DataTable.TableNewRow event.
HTH,
Greetings
.
- Prev by Date: Re: Connection TimeOut
- Next by Date: Re: Detecting Table Locks?
- Previous by thread: Re: Binding DateTimePicker
- Next by thread: Re: Binding DateTimePicker
- Index(es):
Relevant Pages
|