Asp.net Time Input Control Suggestions

14,569

try this code for time entry

   <asp:TextBox ID="txtStartTime" runat="server" Text='<%# Bind("StartTime", "{0:t}") %>'
                                        Width="60px"></asp:TextBox>
                                    <asp:Label ID="lblStartTimeEdit" runat="server" Text="Press 'A' or 'P' to switch AM/PM"></asp:Label>

                                    <cc1:MaskedEditExtender ID="meeStartTime" runat="server" AcceptAMPM="true" MaskType="Time"
                                        Mask="99:99" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError"
                                        ErrorTooltipEnabled="true" UserTimeFormat="None" TargetControlID="txtStartTime"
                                        InputDirection="LeftToRight" AcceptNegative="Left">
                                    </cc1:MaskedEditExtender>
                                    <cc1:MaskedEditValidator ID="mevStartTime" runat="server" ControlExtender="meeStartTime"
                                        ControlToValidate="txtStartTime" IsValidEmpty="False" EmptyValueMessage="Time is required "
                                        InvalidValueMessage="Time is invalid" Display="Dynamic" EmptyValueBlurredText="Time is required "
                                        InvalidValueBlurredMessage="Invalid Time" ValidationGroup="MKE" />
Share:
14,569
Alejandro Guidobaldi
Author by

Alejandro Guidobaldi

.

Updated on June 04, 2022

Comments

  • Alejandro Guidobaldi
    Alejandro Guidobaldi almost 2 years

    Can anyone recommend a Time Input control for an asp.net web application?

    It should be able to handle the following items

    • Am/Pm
    • 24 Hour
    • client side validation
    • client side completion (if you start the hour with a 3 then jump to minute)
    • one textbox (not separate textboxes for hours and minutes, or drop downs)
    • ability to actually type in the time, not simply pick it
    • hint text with time separator ":"

    Other features that would be nice

    • Ability to increase hour or minutes with arrows
    • no need to rewire after a postback

    Thanks in advance for the help and suggestions!

  • pinckerman
    pinckerman over 10 years
    You should summarize or quote the linked article, links tend to decay over time.
  • Bengi Besçeli
    Bengi Besçeli over 6 years
    2. link is broken