Mask Textbox view for a phone number

前端 未结 2 1839
盖世英雄少女心
盖世英雄少女心 2021-01-13 16:27

i am trying to format a text box so that when the users can type in a phone number and it would automatically put it in the following format :(999)999-9999

i tried u

相关标签:
2条回答
  • 2021-01-13 16:36

    Try this

    The propoerty "ClearMaskOnLostFocus" must be false.

    <asp:MaskedEditExtender ID="mskSuperPhone" runat="server"
                       TargetControlID="txtSuperPhone"
                       ClearMaskOnLostFocus ="false"
                       MaskType="None"
                       Mask="(999)999-9999" 
                       MessageValidatorTip="true"
                       InputDirection="LeftToRight"
                       ErrorTooltipEnabled="True">
      </asp:MaskedEditExtender>
    
    0 讨论(0)
  • 2021-01-13 16:53

    To answer your question, you have to set the "ClearMaskOnLostFocus" to false on the extender for the mask to show all the time.

    That being said....

    I strongly suggest that you use the jquery alternative.

    http://digitalbush.com/projects/masked-input-plugin/

    The reason I say this is because the maskededitextender does not work in safari.

    0 讨论(0)
提交回复
热议问题