3
votes

Our not to be changed datalayer returns the DateTime.Mindate when the record's column has a NULL value. So when you put a null value in a record's column and you read it again, you get 01-01-0001.

When binding this value to a DevExpress.XtraEditors.TextEdit control this value (01-01-0001) ofcourse is displayed in the control.

Now we want to show the control as being empty (no content), but i don't know how to achieve that.

I did find out that you can set a custom display text for the control when the object's attribute is NULL, but that doesn't work ofcourse because the value is 01-01-0001 and not null.

So in short: if it's a date with the value of 01-01-0001, show nothing in the control, otherwise, show the date.

Any ideas?

2

2 Answers

1
votes

You can handle the FormatEditValue event to format the date in the way you want.

In the other direction, you use the ParseEditValue event to parse user input.

1
votes

You could use a DateEdit control instead of a TextEdit

Set the NullDate property to 1-1-0001

Turn off the drop down button in the "Buttons" settings if you do not require it. It will then look just like a TextEdit.

Image