CompareValidator Example:
Introduction:
In my previous articles i explained Validation Controls in Asp.Net, RangeValidatorControlExample, RequiredFieldValidator Example and Now i will explain how to use CompareValidator to Compare password and confirmpassword or two values in asp.net.
Description:
CompareValidator Control is used to compare two values. The value to compare can be either a value of another control or a constant specified. There are predefined data types that can be compared like string, integer etc.
1). Add a compareValidator control to the page and set the properties ControlToValidate, ErrorMessage,Text,Display.
2). Set the value to Compare by setting the properties like ValueToCompare, ControlToValidate, Type and Operator.
Age Validation using CompareValidator Control:
Comparing two passwords using CompareValidator Control:
Conclusion:
I hope you got an idea about how to use CompareValidator in Asp.Net Using Age and Phone Number validations.
No comments:
Post a Comment
Please Give your Valuable Suggestions,Questions and Comments to improve my blog.