Compare Validator

A

A.M

Hi,

Can I use compare validator to make sure that the value of two text boxes
are the same?

Thanks,
Alan
 
A

A.M

How?
The ValueToCompare property accepts a value. How can I refer it to text
property of another textbox?

Thanks for reply
Alan
 
N

Neo

If you want to compare a specific input control with another input control,
set the ControlToCompare property to specify the control to compare with.
 
Joined
Aug 23, 2007
Messages
1
Reaction score
0
What a dreadful response. Here is an example.

Password:
<asp:TextBox id="txtPswd" runat="server" text=""></asp:TextBox>

Confirm Password:
<asp:TextBox id="txtPswdConfirm" runat="server" text=""></asp:TextBox>

<asp:CompareValidator
ID="ComparePasswords"
runat="server"
ErrorMessage="Passwords DO NOT Match."
ForeColor="red"
ControlToValidate="txtPswd"
ControlToCompare="txtPswdConfirm">
</asp:CompareValidator>

<asp:CompareValidator
AccessKey="string"
AssociatedControlID="string"
BackColor="color name|#dddddd"
BorderColor="color name|#dddddd"
BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
BorderWidth="size"
ControlToCompare="string"
ControlToValidate="string"
CssClass="string"
CultureInvariantValues="True|False"
Display="None|Static|Dynamic"
EnableClientScript="True|False"
Enabled="True|False"
EnableTheming="True|False"
EnableViewState="True|False"
ErrorMessage="string"
Font-Bold="True|False"
Font-Italic="True|False"
Font-Names="string"
Font-Overline="True|False"
Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
Font-Strikeout="True|False"
Font-Underline="True|False"
ForeColor="color name|#dddddd"
Height="size"
ID="string"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
Operator="Equal|NotEqual|GreaterThan|GreaterThanEqual|LessThan|
LessThanEqual|DataTypeCheck"
runat="server"
SetFocusOnError="True|False"
SkinID="string"
Style="string"
TabIndex="integer"
Text="string"
ToolTip="string"
Type="String|Integer|Double|Date|Currency"
ValidationGroup="string"
ValueToCompare="string"
Visible="True|False"
Width="size"
/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top