Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

MaskedEditExtender with RegularExpressionValidator not working correct

$
0
0

Application has telephone number I want to mask (999)999-9999), then use RegularExpressionValidator to validate.  Even after I enter a correct telephone number focus keeps going back to the text box. I have searched web and cannot get it to work.  Here is my code:

<asp:TextBox ID="txtContPhone" runat="server" Width="125px" ></asp:TextBox>   <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtContPhone" Mask="(999)999-9999" ClearMaskOnLostFocus="false"
                        MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus" OnInvalidCssClass="MaskedEditError" MaskType="None" InputDirection="LeftToRight"
                        Filtered="-" ErrorTooltipEnabled="True"  AutoComplete="false"/><asp:RegularExpressionValidator ID="RqdFldValtxtContPhone" runat="server"  ControlToValidate="txtContPhone" 
                       ValidationExpression="(?:(((\d{3}))|(\d{3}-))?\d{3}-\d{4})|((((_{3}))|(_{3}-‌​))?_{3}-_{4})"
                            ErrorMessage="Required" ForeColor="Red" Font-Bold="true" SetFocusOnError="True" Display="Dynamic"></asp:RegularExpressionValidator>


Viewing all articles
Browse latest Browse all 5678

Trending Articles