Here's an easy way to check to make sure that the User enters an Integer in an Integer field.
<asp:CompareValidator ID="CompareValidatorErrors" ErrorMessage="Please Enter an Integer" Type="Integer" Operator="DataTypeCheck" ControlToValidate="TxtNumberErrors" runat="server"></asp:CompareValidator>
You can specify the ValidationTypeProperty within the Type property to specify (Currency, DateTime, Double, Integer, String) to Compare against.
Tuesday, March 3, 2009
Use Compare Validator to check your Integers!
Labels:
ASP.NET,
C#,
Compare Validators,
Validate Int,
Validate Integers C#
Subscribe to:
Post Comments (Atom)
1 comment:
Simple yet effective.
Post a Comment