asp.netajaxcontroltoolkitmaskededitextender

AJAXControlToolkit MaskedEditExtender behavior


I am referencing the latest AJAXControlToolkit in my ASP.Net 4.0.xxx WebForm application. I am using the extender to format a phone number field as follows. If the field is left empty then I don't need any mask showing up. But if the phone number is entered then I don't want the mask to disappear when tabbed away from that field, but this is exactly whats happening. The hyphens in the mask disappear and only numbers are left in the field. How can I prevent this from happening?

<asp:TextBox ID="Contact_HomePhone" runat="server" MaxLength="50"></asp:TextBox>

<ajaxToolkit:MaskedEditExtender 
   Mask="999-999-9999" MaskType="Number" ClearMaskOnLostFocus="True"
   ID="Contact_HomePhone_MaskedEditExtender" runat="server"  TargetControlID="Contact_HomePhone"  />

Thanks.


Solution

  • I am going with jQuery MaskedInput code and it is working exactly as I wanted and even more.

    Thanks for all the feedback!