You can use CompareValidator
,
Compares the value entered by the user in an input control with the value entered in another input control, or with a constant value.
<asp:TextBox ID="TextBox1" runat="server />
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1" Type="Integer"
Operator="DataTypeCheck" ErrorMessage="Wrong value. Value must be an integer!" />
As an alternative, you can use RegularExpressionValidator
with "\d+"
pattern.