The CompareValidator control compares the value of one control to another, or to an explicit value in the control's ValueToCompare property. CompareValidator uses three key properties to perform its validation. ControlToValidate and ControlToCompare contain the values to compare. Operator defines the type of comparison to perform, for example, Equal, Not Equal, Greater than, Less than, DataType and others. CompareValidator performs the validation by evaluating these properties as an expression.
The ValueToCompare property can be set dynamically by Javascript if necessary, for example, you can use it with a DropDown list you want to make sure that selected value not equal to -1.
When the type of value being compared is not a string, you have to specify the Type property as one of the following:
- String
- Integer
- Double
- Date
- Currency
WhitePapers/Blogs
Revision number 4, Wednesday, November 12, 2008 7:02:25 AM by rami_nassar
You must Login to comment.
|
Thu, Jun 12, 2008 4:24 AM
by engmaamun
|
good..............
|
|
Mon, Nov 10, 2008 5:52 AM
by abidshahzad
|
Great I was searching about it. You have solved my problem. Thanks for useful links.
|
|
Wed, Nov 12, 2008 8:56 AM
by shailatlas
|
Very Nice. I was also looking for comparing dates
|
|
Thu, Nov 13, 2008 7:39 AM
by shabeer_Ahamad
|
contact me on mymail id as shabeer277@gmail.com
|
Revision #3
Wed, Feb 20, 2008 5:04 AM
by
|
CustomValidator
The CompareValidator control compares the value of one control to another, or to an explicit value in the control's ValueToCompare property. CompareValidator uses three key properties to perform its validation. ControlToValidate and ControlToCompare contain
|
Revision #3
Wed, Apr 16, 2008 9:01 PM
by
|
customvalidator
The customvalidator control allows writing custom validation for a control. So, if the others validators: RangeValidator, RequiredFieldValidator, RegularExpressionValidator, CompareValidator, is not useful for a specific validation, it is possible to write
|
Revision #17
Tue, Feb 12, 2008 8:02 PM
by
|
Web Controls
Web controls are ASP.NET controls which are understood and compiled on the server and render as HTML markup on the page. Most of the web server controls render their own HTML controls (or many HTML controls). The markup that is output froma web control can
|