How do I restrict single zero in a numeric textbox? Textbox can accept any number but it should not accept only zero as value.
Example: "1984500" is valid but "0" is invalid.
Edited:
Is it possible to give maximumvalue as infinity?
How do I restrict single zero in a numeric textbox? Textbox can accept any number but it should not accept only zero as value.
Example: "1984500" is valid but "0" is invalid.
Edited:
Is it possible to give maximumvalue as infinity?
Using a RegularExpressionValidator with the following regex: \d*[1-9]\d*
I'd use a RangeValidator and set the minimum value to 1.
<asp:RangeValidator ID="range1" RunAt="server"
ControlToValidate="Textbox1"
MinimumValue="1"
MaximumValue="2147483647"
Type="Integer"
EnableClientScript="false"
Text="The value must be greater than 0" />
This should take care of it. Allows a single digit 1-9 or a collection of digits 2 or more.
[1-9]|\d{2,}