Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replacing '01-01-0001' with empty string on databound DevExpress.XtraEditors.TextEdit control

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?

like image 313
Michel Avatar asked Dec 06 '25 15:12

Michel


1 Answers

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

like image 189
Kuffs Avatar answered Dec 08 '25 16:12

Kuffs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!