When keying a date into an UltraDateTimeEditor, the ValueChanged event fires when 5 digits are entered .. for example 1 2 3 1 0 will fire ValueChanged, and the value is Dec 31, 2000. This makes subscribing to the ValueChanged event handler unusable. Typically, my users would enter 2 to 4 digit years, never a 1 digit year.
However, when a user chooses a date from the calendar drop down, I want to immediately respond to this choice. I can only do this by subscribing to the ValueChanged event, but that is unreliable. Instead, I must use either Leave or AfterExitEditMode, which isn't as slick and responsive as I want my application to be.
So I really have two issues:
An answer to either of these would give me something to work with. Thanks!
Hi,
I am getting same problem what you had discussed earlier, I have assigned the value to the BO property through databindings, so I cannot add AfterExitEditMode for this control alone.
I am using custom control which is inherit from UltraDateTimeEditor(ver 9.1) , Is there anyway to solve this problem only change in the custom control?
Hi Greg,
The reason it works this way is that the control is using DateTime.Parse to make a date out of the text you entered.
When you enter a "1", DateTime.Parse will failed to convert this into a valid date. So the value of the control will be null. When you type the "2", once again, this will fail to make a valid date, and so the value of the control is still null. Since there has been no change, the ValueChanged doesn't fire.
Once you get to "12310", this is the first time that DateTime.Parse resolves to a valid date and so the Value of the control changes at this point.
So the only way I can see for you to get around this would be to examine the Text property inside ValueChanged and see how many digits there are or do your own date parsing to determine if you want to respond or not.