RadMaskedTextBox ssn格式

时间:2014-06-16 22:53:37

标签: css asp.net internet-explorer telerik

我为SSN输入一个RadMaskedTextBox,同时在其中输入值,前两个字符正在清理自己并获取RegularExpressionValidator消息。有些人可以帮助我。这个问题只在IE浏览器中出现。

 <span id="SSN" runat="server">*</span>Social Security Number</label>
        <asp:RegularExpressionValidator ID="TaxId_RegEx" 
runat="server" ControlToValidate="TaxId"
            Display="None" ValidationExpression="^\d{3}\-\d{2}\-\d{4}$" ErrorMessage="Please enter a valid 9 digit SSN."  Enabled="true"></asp:RegularExpressionValidator>
        <asp:RequiredFieldValidator ID="TaxId_ReqField"
 runat="server" ControlToValidate="TaxId"
            Display="None" ErrorMessage="Please enter a value for this required field."></asp:RequiredFieldValidator>
        <radI:RadMaskedTextBox CssClass="box_SSN" SelectionOnFocus="SelectAll" ID="TaxId"
            Width="85px" Mask="###-##-####" runat="server">
        </radI:RadMaskedTextBox>

1 个答案:

答案 0 :(得分:0)

尝试:

^\d{3}-\d{2}-\d{4}$

而不是:

^\d{3}\-\d{2}\-\d{4}

这在IE中非常适合我:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  

<asp:RequiredFieldValidator   
         ID="RequiredFieldValidator1"  
         runat="server" ControlToValidate="TextBox1" Text="*">  
</asp:RequiredFieldValidator>  

<asp:RegularExpressionValidator   
        ID="RegularExpressionValidator1"  
        runat="server"   
        ValidationExpression="\d{3}-\d{2}-\d{4}"  
        ControlToValidate="TextBox1"  
        ErrorMessage="Input valid SSN!">
</asp:RegularExpressionValidator>  

<asp:Button ID="Button1" runat="server" Text="Submit"/>  

不确定你为什么

  

显示=&#34;无&#34;