0

I am trying to use a masked edit extender for a text box that is to display time zone offset, in the form of 05:00 or -05:00, for example. The following is what I used and it initially displays the mask and allows me to enter either of the above. But when I leave the textbox, it removed the colon and I get invalid format error. What am I missing here? (I changed the MaskType from Number to None hoping it would not drop : but it does).

<asp:TextBox runat="server" ID="tbTZOffset" CssClass="NormalSmall" Text="" />
<ajaxToolkit:MaskedEditExtender runat="server" ID="meeTZO"
    TargetControlID="tbTZOffset" 
    Mask="99:99"
    MessageValidatorTip="false" 
    MaskType="None" 
    InputDirection="LeftToRight" 
    AcceptNegative="Left" 
    ErrorTooltipEnabled="True"/>
<ajaxToolkit:MaskedEditValidator runat="server" ID="mevTZO"
    ControlExtender="mevTZO"
    ControlToValidate="tbTZOffset" 
    IsValidEmpty="False" 
    EmptyValueMessage="Time Zone Offset is required"
    InvalidValueMessage="Time Zone Offset is invalid (must be in [-]hh:mm format)"
    EmptyValueBlurredText="*" 
    Display="none" 
    ValidationExpression="\b[-]?\d{2}:\d{2}\b" 
    TooltipMessage="Time Zone Offset in [-]hh:mm format" 
    ValidationGroup="vgConfig"/>                                            

Added info:

I downloaded the newest version of Ajax Control Toolkit for .Net 3.5 (July 2013 version) ; apparently there was a bug in previous versions.

I can set MaskType="Number", Mask="NNNNNN" and Filtered="-:", enough characters to allow for 4 digits, negative sign and colon. This seems to allow me to enter both 05:00 and -05:00 but if I enter 05:00, it leaves one space at the end to be filled (i.e. keeps showing the last undercsore like 00:05_ ). It also allows me to enter 05:008.

If I change the mask type back to "None", I lose the ability to enter negative numbers again.

I have run out of ideas and am ready to just forget about this control. I am not sure if these developers do any kind of testing before releasing their "product".

NoBullMan
  • 2,032
  • 5
  • 40
  • 93
  • I gave up and used a watermark extender to tell users what format to use to enter time zone offset, and a custom validator to validate it. I just hope these Ajax Control Toolkit developers would spend some time beyond minimum requirement to test their controls before releasing them. – NoBullMan Sep 26 '13 at 02:01

0 Answers0