Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing two fields in validation

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
I have two fields where if they are both blank it is ok, but if one is filled out then the other one must be filled out also, How would I validate this with asp.net? Comparevalidator? if so, how?

[conehead]
 
something like this:
Code:
<asp:CompareValidator id="valCompare" runat="server"
    ControlToValidate="textbox1" ControlToCompare="textbox2"
    Operator="Equals"
    ErrorMessage="your error message"
    Display="dynamic">
</asp:CompareValidator>

make changes to adapt to your requirements...

-DNG
 
hmmm - I think that is going to make sure the two boxes are equal... I just want to make sure that if 1 has a value then they both have a value...

[conehead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top