System.Web
1.0.5000.0
2.0.0.0
Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.
System.Web.UI.WebControls.BaseCompareValidator
System.Web.UI.ToolboxData("<{0}:CompareValidator runat="server" ErrorMessage="CompareValidator"></{0}:CompareValidator>")
Use the control to compare the value entered by the user in an input control, such as a control, with the value entered in another input control or a constant value. The control passes validation if the value of the input control matches the criteria specified by the , , and/or properties.
You can also use the control to indicate whether the value entered in an input control can be converted to the data type specified by the property.
Specify the input control to validate by setting the property. If you want to compare a specific input control with another input control, set the property to specify the control to compare with.
If the value entered in the input control specified by the property cannot be converted to the data type specified by the property, but the value entered in the input control specified by the property can be converted, the input control being validated is considered valid. Therefore, you should also place a or control on the input control specified by the property.
Instead of comparing the value of an input control with another input control, you can compare the value of an input control to a constant value. Specify the constant value to compare with by setting the property.
If the value specified by the property cannot be converted to the data type specified by the property, an exception is thrown. Be sure to check the data type of a value before programmatically assigning it to the property.
Do not set both the and the property at the same time. You can either compare the value of an input control to another input control, or to a constant value. If both properties are set, the property takes precedence.
Use the property to specify the type of comparison to perform, such as greater than, equal to, and so on. If you set the property to ValidationCompareOperator.DataTypeCheck, the control ignores the and properties and simply indicates whether the value entered in the input control can be converted to the data type specified by the property.
The property is used to specify the data type of both comparison values. Both values are automatically converted to this data type before the comparison operation is performed.
When the property is set to and the current calendar type is non-Gregorian, the validator performs server-side validation only. The validator client script supports only Gregorian calendars.
The following table lists the various data types that can be compared.
-
Data type
Description
-
String
A string data type.
-
Integer
A 32-bit signed integer data type.
-
Double
A double-precision floating-point number data type.
-
Date
A date data type.
-
Currency
A decimal data type that can contain currency symbols.
If the input control is empty, no validation functions are called and validation succeeds. Use a control to require the user to enter data in the input control.
When you use the control inside an control, make sure that the validator control and the control it is associated with are in the same panel. For more information about using the control for partial-page updates, see Partial-Page Rendering Overview.
For more information about validation controls, see .
Accessibility
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.
Compares the value entered by the user in an input control with the value entered in another input control, or with a constant value.
Constructor
The default constructor initializes any fields to their default values.
Initializes a new instance of the class.
1.0.5000.0
2.0.0.0
Method
1.0.5000.0
2.0.0.0
System.Void
To be added.
To be added.
Adds the attributes of this control to the output stream for rendering on the client.
Method
1.0.5000.0
2.0.0.0
System.Boolean
To be added.
Checks the properties of the control for valid values.
true if the control properties are valid; otherwise, false.
Property
System.String
To be added: an object of type 'string'
Use the property to specify an input control, such as a control, to compare with the input control being validated. If the input control specified by this property is not a control on the page, an exception is thrown.
Do not set both the and the property at the same time. You can either compare the value of an input control to another input control, or to a constant value. If both properties are set, the property takes precedence.
For more information, see .
If the control to compare is hidden or is inside a container (such as a control) that is not visible, the validator performs server-side validation only. The validator client script supports only visible controls.
This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.
Gets or sets the input control to compare with the input control being validated.
1.0.5000.0
2.0.0.0
System.Web.UI.Themeable(false)
System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))
System.ComponentModel.DefaultValue("")
Method
System.Boolean
To be added
When overridden in a derived class, this method contains the code to determine whether the value in the input control is valid.
true if the value in the input control is valid; otherwise, false.
1.0.5000.0
2.0.0.0
Property
System.Web.UI.WebControls.ValidationCompareOperator
To be added: an object of type 'ValidationCompareOperator'
Use the property to specify the comparison operation to perform. The following table lists the comparison operations that are possible.
-
Operation
Description
-
Equal
A comparison for equality between the values of the input control being validated and another control, or a constant value.
-
NotEqual
A comparison for inequality between the values of the input control being validated and another control, or a constant value.
-
GreaterThan
A comparison for greater than between the values of the input control being validated and another control, or a constant value.
-
GreaterThanEqual
A comparison for greater than or equal to between the values of the input control being validated and another control, or a constant value.
-
LessThan
A comparison for less than between the values of the input control being validated and another control, or a constant value.
-
LessThanEqual
A comparison for less than or equal to between the values of the input control being validated and another control, or a constant value.
-
DataTypeCheck
A data type comparison of the value entered in the input control being validated and the data type specified by the property. Validation fails if the value cannot be converted to the specified data type.
The and properties are ignored when this operator is used.
This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.
Gets or sets the comparison operation to perform.
1.0.5000.0
2.0.0.0
System.Web.UI.Themeable(false)
System.ComponentModel.DefaultValue(System.Web.UI.WebControls.ValidationCompareOperator.Equal)
Property
System.String
To be added: an object of type 'string'
Use the property to specify a constant value to compare with the value entered by the user in the input control being validated. If the constant value specified by this property fails to convert to the data type specified by the property, an exception is thrown.
Do not set both the and the property at the same time. You can either compare the value of an input control to another input control, or to a constant value. If both properties are set, the property takes precedence.
This property cannot be set by themes or style sheet themes. For more information, see and ASP.NET Themes Overview.
Gets or sets a constant value to compare with the value entered by the user in the input control being validated.
1.0.5000.0
2.0.0.0
System.Web.UI.Themeable(false)
System.ComponentModel.DefaultValue("")