System.Web.UI.WebControls.CompareValidator.ControlToCompare Property

Gets or sets the input control to compare with the input control being validated.

Syntax

[System.Web.UI.Themeable(false)]
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.ValidatedControlConverter))]
[System.ComponentModel.DefaultValue("")]
public string ControlToCompare { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the CompareValidator.ControlToCompare property to specify an input control, such as a System.Web.UI.WebControls.TextBox 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.

Note:

Do not set both the CompareValidator.ControlToCompare and the CompareValidator.ValueToCompare 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 CompareValidator.ControlToCompare property takes precedence.

For more information, see BaseValidator.ControlToValidate.

Note:

  If the control to compare is hidden or is inside a container (such as a System.Web.UI.WebControls.Panel 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 System.Web.UI.ThemeableAttribute and ASP.NET Themes Overview.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0