I am using a WinDatetimeEditor and displaying the date and time. I have a mask on the editor {LOC}dd/mm/yyyy hh:mm.
If the User sets the hours but leaves the minutes blank, when they leave the editor it reverts to the previous time entered, presumably because it sees the blank minutes as an invalid. The behaviour I want is that if the minutes are left blank then for them to be set to 00. What is the best way to acheive this ?
Thanks for your helpjohn
John,
I just tried this out and this worked correctly for me. I tried changing various values in the control, all without exiting edit mode (including changing the hours), then deleting the digits in the minutes section, and when I tabbed out of the control the minues were now "00". What version of the controls are you using? It's possible that something was fixed in the latest service release. You might also want to look at the InvalidTextBehavior property, though I didn't have to alter this in my test.
-Matt
Matt,
Thanks for testing this for me. I am using version 8.3.20083.1009. I will also check that i am using the latest service release. I should have mentioned that the editor is data bound to a DateTime field in a custom object. when I do a test without the databinding then the results are OK as you have mentioned. However when the control is databound I get the problem.
Thanks John
I get the same behavior you do. After looking into it further, I'm a bit surprised that it works without the data binding; in fact after trying it again I could reproduce it without the data binding, so I must have been doing something slightly differently (though you could reproduce it too). The reason that you're encountering this behavior is because the control cannot parse a date from the provided string with empty values, so it reverts to a valid value (controlled by the InvalidTextBehavior property). Fortunately, you could implement your own workaround as I have detailed in another thread (that I had forgotten about until now :-))