验证用户输入的是否为整型。你可以使用下面正则表达式:

<asp:TextBox ID="txtWorkNumber" runat="server" onkeyup="value=value.replace(/[^\d]/g,'')"
                    onbeforepaste
="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                    CssClass
="textbox"></asp:TextBox>

 

或者使用asp.net验证Comparevalidator,有一个Type="Integer",如:

 <asp:CompareValidator ID="CompareValidator3" runat="server" ControlToValidate="txtNumber"
                                                                            
Type="Integer" Operator="dataTypeCheck" ErrorMessage="招聘人数栏位,非有效数值!"></asp:CompareValidator>

相关文章:

  • 2021-12-24
  • 2021-09-14
  • 2022-01-15
  • 2022-02-22
  • 2021-06-08
  • 2021-09-26
  • 2021-06-05
猜你喜欢
  • 2021-12-04
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2021-05-25
  • 2021-06-29
  • 2021-12-09
相关资源
相似解决方案