Every time I have to build a form with a DateTime field I try to find a decent free custom control - I always fail.
I cannot figure out why it isn't built in the .NET but let's forget about for a minute and concentrate on my question :D
Anyone got one?
-
I just did a quick Google and came across this one...
http://www.softcomplex.com/products/tigra_calendar/demo1.html
Looks like it supports dates and times, and it appears to be free.
DrG : javascript not a .NET custom controlDrG : but may do the job! thanks :DBoltBait : Does it really make a server hit every time you click on something in the calendar? That's lame. I prefer a client-side solution. -
Just combine these two
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/
http://keith-wood.name/timeEntry.html
jQuery is where it's at!
Chris Marisic : I agree jQuery is the way to go. -
I've had fairly good luck with this one:
DrG : i don't think it had a time componentJasonS : They do: http://www.eworldui.net/CustomControls/TimePicker.aspx -
Check the Calendar control extender from the MS AJAX Control Toolkit, I really like it.
DrG : does it do time? -
Use two separate TextBoxes, one for date and one for time. For the date one, use the ASP.NET Ajax Control Toolkit Calendar control, as someone else pointed out.
For the time TextBox, have a look at the MaskedEditExtender control in the same toolkit. You can set it to display ::__ AM/PM and let the user fill in. You can fill with zeros if they just type "3p" and tab out.
To use it, you need a TextBox. You set the MaskedEditExtender's TargetControlID to the TextBox's ID. Here are some attributes you'll need to set in the MaskedEditExtender tag for time entry:
Mask="99:99" AutoCompleteValue="00:00" AcceptAMPM="true" MaskType="Time"Also, if you get a weird FindControl-related error, make sure that your MaskedEditExtenders all have IDs set.
DrG : sweet looks like what I'm after nice an simple, really prefer not to use third party stuff if I can help it.DrG : yes, this is perfect thanks -
Many thanks. This works nicely indeed.
<asp:TextBox runat="server" ID="startDate" autocomplete="off" /> <ajaxToolkit:CalendarExtender ID="defaultCalendarExtender" runat="server" TargetControlID="startDate" /> <asp:TextBox ID="startTime" runat="server" Columns="8"></asp:TextBox> <ajaxToolkit:MaskedEditExtender ID="startTime_MaskedEditExtender1" runat="server" Enabled="True" TargetControlID="startTime" MaskType="Time" AutoCompleteValue="09:00" Mask="99:99" AcceptAMPM="true"> </ajaxToolkit:MaskedEditExtender> <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="startTime_MaskedEditExtender1" ControlToValidate="startTime" IsValidEmpty="False" EmptyValueMessage="Time is required" InvalidValueMessage="Time is invalid" Display="Dynamic" TooltipMessage="Input a time" EmptyValueBlurredText="*" InvalidValueBlurredMessage="Check time"> -
The Ra-Ajax Calendar control will actually be released the upcoming Friday (28th of November 2008) with Time support (two textboxes between the Today button and the dates)
Ra-Ajax is LGPL licensed and Free of Charge to use...
0 comments:
Post a Comment