I am deriving a custom control from the RadDateTimePicker (version: 2011.1.11.419 or Q1 2011) trying to get it to work with null values. We need it to display an empty string when bound to a null value. For the most part this is working with the code below.
If I am viewing a record with a date value and change to another record with a date value all is well. If I then change to a record with a null date it displays fine. But when I change back to a record with a date value nothing is displayed. I would also like to remove the hard coded format in the Value Changed event handler. I am binding RadDateTimePicker.Value to a DateTime? field on Csla objects not a data table.
Thanks,
grj
public new DateTime? Value { get { if (_value.HasValue) return _value.Value; return _value; } set { if (_value != value) { _value = value; OnValueChanged(new EventArgs()); } } }
public new DateTime? NullDate { get { return _nullDate; } set { _nullDate = null; } }void AmDateTextBox_ValueChanged(object sender, System.EventArgs e) { if (this.Value == null) { this.SetToNullValue(); } else { this.DateTimePickerElement.TextBoxElement.TextBoxItem.Text = this.Value.Value.ToShortDateString(); } }If I am viewing a record with a date value and change to another record with a date value all is well. If I then change to a record with a null date it displays fine. But when I change back to a record with a date value nothing is displayed. I would also like to remove the hard coded format in the Value Changed event handler. I am binding RadDateTimePicker.Value to a DateTime? field on Csla objects not a data table.
Thanks,
grj