DateTimePickerAdv Null Value

I''m having a problem with the dattimepickeradv control. I have the datetimepicker bound to a text box to see the results of the datetimepicker. I get peculair results when I click on the ''none'' button, the bound value shown in the text box shows todays date instead of null. why would this be?

1 Reply

AD Administrator Syncfusion Team April 29, 2005 04:47 PM UTC

Hi Eric, Since DataTime is a value type, it can''t be given a null value. Therefore, DateTimePickerAdv represents a null date with the IsNullDate property. So to have a TextBox display Null if the date is null, you need to do something like this: private void dateTimePickerAdv1_ValueChanged(object sender, System.EventArgs e) { if (this.dateTimePickerAdv1.IsNullDate) { this.textBox1.Text = "Null"; } else { this.textBox1.Text = this.dateTimePickerAdv1.Value.ToLongDateString(); } } Regards, Gregory Austin Syncfusion Inc. P.S. DateTimePickerAdv is a part of the Editor package of Tools, not Edit.

Loader.
Up arrow icon