Skip navigation

ASP.NET: Fastest Spin Control For Time Entry - HH:MM

In my last Web interface, my Boss asked me to provide a "spin control" for the users to give the time in format in a restricted and validated custom control.
Well, the best option I found was to create a light custom control on my own which does the processing on the client side for optimized approach and sets the value in the server side control, so that I can retreive the value in ASP.NET code and save it in my storage.

Well, for that I placed some literal controls and used the following code in the onLoad event of the form.

The suuporting JavaScript code and the CSS should also be included in the head section of the page in designer mode.

The function parameter - strTargetValueTextID is the id of the server side control from which you can retreive the data (in minutes), and litClientControl is the id of the literal control that will be used as the container to create the control.

Hope this will provide a better method then other ones.

Please feel free to post your comments/suggestion.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.