Last post Dec 07, 2010 04:15 AM by vijaypant
Dec 03, 2010 10:18 AM|vernonmechery|LINK
I am trying to create a textbox in which user can enter time in the format say:
User can just enter time in the above mentioned format and nothing else. Other than using the MaskededitExtender of Ajax, which is the best possible way to achieve this?
Thanks in advance,
Dec 03, 2010 10:28 AM|XIII|LINK
If you take a look at this page with Chrome, latest version, then you can see it already working:
Dec 03, 2010 10:29 AM|vijaypant|LINK
You can take two TextBoxes - one for hour and one for minutes
and then combine to create one custom user control with required functionality.
But with this technique user must fill in the two text boxes.
Dec 06, 2010 05:45 AM|zwc|LINK
In code-behind, please use this code to retrieve the data.
DateTime result = new DateTime();
DateTime.TryParse(TextBox1.Text, out result);
Dec 06, 2010 06:20 AM|kkostov|LINK
Or you can use a jQuery plug-in as a time picker.
e.g. http://trentrichardson.com/examples/timepicker/ or others.
Dec 07, 2010 04:15 AM|vijaypant|LINK
Hi, you can also use a simple TextBox with RegularExpression Validator to achieve the desired outcome.
And use a regular expression something like: "[0-9]:[0-9][0-9]"
This expression is just an example but you can form some more strict expression.