Ajax Control Toolkit MaskedEditExtender Phone number area code preset

172 Views Asked by At

I have this code:

<asp:TextBox runat="server" ID="txtPhone" TextMode="Phone"></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="maskPHone" runat="server" TargetControlID="txtPhone"
                        ClearMaskOnLostFocus="true" MaskType="None" Mask="(212) 999-9999"
                        MessageValidatorTip="true" InputDirection="LeftToRight" ErrorTooltipEnabled="true">
                    </ajaxToolkit:MaskedEditExtender>

My purpose is to have an area code predefined so that users don't need to always enter it unless they have to.

When the pages loads the first time, it will display (212) ___-____ and allow me to type phone number without a problem.

The problem comes when I click somewhere on the form and click on this textbox again, it will always add additional 212 to the textbox, thus become (212) 212-____, then (212) 212-212_, and so on. How do I resolve this issue?

0

There are 0 best solutions below