Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
WebDateTimeEdit for time spans
posted

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