asp.net.ph

CompareValidator.ControlToCompare Property

System.Web.UI.WebControls Namespace   CompareValidator Class


Sets or retrieves the input control to compare with.

Syntax


Inline <asp:comparevalidator controltocompare = strID ... >
Script CompareValidator.ControlToCompare = strID

Property Value


strID String specifying the ID of the control to compare with.

The property is read/write with no default value.

Remarks

Use the ControlToCompare property to specify an input control, such as a TextBox, to compare with the input control being validated.

You can either compare the value of an input control to another input control, or to a constant value. However, you can not set both the ControlToCompare and ValueToCompare properties at the same time. If both properties are set, ControlToCompare takes precedence.

If ControlToCompare is specified, but the control is invalid, or is not a control on the page, an exception is thrown and no further processing is done.

Example

The following example shows how to declaratively set the ControlToCompare property of a CompareValidator control at design time.

<asp:comparevalidator id = "comp1" 
   controltovalidate = "txtComp" 
   controltocompare = "txtCompTo" 
   type = "String" runat = "server" />

 Show me 

See Also

CompareValidator Members   Validating Against a Specific Value Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph