tags:

views:

71

answers:

2

hi every body

In Asp.Net, what control is more suitable for getting time (hh:mm) from user and pass it as a parameter to a query?

+2  A: 

I believe you have to choose between the following three:

  1. Use a TextBox and do extensive input validation.
  2. Use solution #1, but add a client side time picker on top of the TextBox.
  3. Use two DropDownList controls - one for hours, one for minutes.
  4. Use some kind of third-party time picker control.

Which one is better? I would say, that depends a lot on the expected users of your application. Anyone used to working with a keyboard is likely to prefer the TextBox. Others might prefer the other options. For the broad masses, I would most likely go for solution #2, as it should suit both keyboard and mouse centric users.

If you choose to go with a third-party control, be wary that it might not degrade gracefully for users that do not accept Javascript. The control might just revert to a simple TextBox, possibly without any validation logic.

Jørn Schou-Rode
+3  A: 

If you don't mind using the ASP.NET Ajax Control Toolkit, you can use the MaskedEdit control. The second example shows you how to let users enter a time-value.

Kristof Claes