CompareValidator Control in ASP.NET

In this article I will explain about CompareValidator control in ASP.NET. This type of control in ASP.NET help in validation processes, allowing to evaluate values between two input types

Getting Started

What is CompareValidator Control?

CompareValidator Control allows to evaluate the value of an input control against a constant value or the value of another input control to determine whether the two values match the relationship specified.






ErrorMessage="Emails are different!"




In this example we will compare two entered emails are equal, Add two labels, two text boxes and a button:

form CompareValidator Control in ASP NET

Then, after creating the form, add the CompareValidator control.

toolbox CompareValidator Control in ASP NET

This control will compare the value of its ControlToValidate with ControlToCompare. It uses the comparison operators to do the same.

Follow these properties:

Properties CompareValidator Control in ASP NET

The result would be something like this:

result CompareValidator Control in ASP NET

This concludes CompareValidator Control in ASP.NET

Looking for quality Windows Hosting? Look no further than Arvixe Web Hosting!

Happy Hosting

Rodolfo Hernandez

Tags: , , , , , , , , , , | Posted under ASP .NET 2, ASP .NET 3.5, ASP .NET 4.0, DotNet/Windows Hosting | RSS 2.0

Author Spotlight

Rodolfo Hernandez

I like photography and reading books. Currently working for Arvixe as Elgg Community Liaison. Elgg Security Expert Web Security Expert CEO of UDP SW Social Web

Leave a Reply

Your email address will not be published. Required fields are marked *