Hi guys,
I want to do like this, for example, first time, I input "31/05/2008" in the ultraDateTimeEditor, it's valid, sencond time input "31/06/2008", it's invalid, but the ultraDateTimeEditor control will auto replace the value by "31/05/2008", whether I can prevent it? Because I want to do the validation by myself
Regards
Wei Wei
Have you tried handling the Validating event of the control?
Yes, tried,still handle the case.
Hi, is there any workaround? User is complaining ... the event don't allow us to control anything. thanks.
I solve this by using the BeforeExitEditmode :
If Not txtDate.Editor.IsValid Then
txtDate.Value = Nothing
e.Cancel = True
End If
End Sub
The Value of the actual control is likely never going to be an invalid value, which is why I suggested dealing with the editor itself. Again, I'm not sure if this type of functionality is possible, but you could certainly try manipulating the value of the editor directly as I mentioned.
-Matt
The value I able to check is throguh UltraDateTimeEditor.Value, but seems it has been converted to a valid datetime when you try to get it.
I don't know that there's any way to have manual control over what the editor replaces an invalid value with, outside of the InvalidTextBehavior property on the control. You could always use the TextChanged event and check the Editor.IsValid property, though you should probably check the Editor.IsInEditMode property first; the downside to this approach would be that it would fire often and you would have to see if all the values are filled instead of only partially.