Hi!
I need control for entering time spans (5 seconds, 1 hour and 56 seconds...). I use WebDateTimeEdit control created by following code:
WebDateTimeEdit timeSpan = new WebDateTimeEdit() { ID = "Name", CssClass = "plain_textbox", Height = new Unit("16px"), Width = new Unit("100px"), EditModeFormat = "d.HH:mm:ss", DisplayModeFormat = "d.HH:mm:ss", DataMode = DateDataMode.EditModeText, EnableViewState = true, UseLastGoodDate = false, PromptChar = '0', MinimumNumberOfValidFields = 0 };
The problem is that I can't enter 5 seconds span. I should enter the first part (1.00:00:05, but not 0.00:00:05), otherwise date is considered as invalid and I loose it after control looses focus. As you see I set MinimumNumberOfValidFields to 0, but it doesn't help.
So, what should I do? Is there any other useful controls? WebMaskEdit is useless because it allows spans like 45:78:99
Thank you Victor for your response.
I've eventually created a control which inherits from the WebMaskEdit control, added some logic and it seems to do the trick...
Hi Almes,
The WebDateTimeEditor relies on the Date object on client and DateTime object on server to handle dates. Both of those objects do not support dates with dayOfMonth=0, so WebDateTimeEditor is not able to validate/process these date values neither.
The time-formats appear in editor as portions of valid dates which other fields are not displayed.
Hi ega1978,
Have you find a solution for your issue? I have the exact same problem...
Thanks
Hi,
That is correct WebDateTimeEditor considers a date with day-field = 0 as invalid, therefore, whole entry is considered invalid too. WebDateTimeEditor was not designed for TimeSpan. If it is acceptable for your application, then the best you can do, is remove 'd' from format.