IValidator Interface
Collapse the table of content
Expand the table of content

IValidator Interface


Defines the properties and methods that objects that participate in Web Forms validation must implement.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public interface class IValidator


When implemented by a class, gets or sets the error message text generated when the condition being validated fails.


When implemented by a class, gets or sets a value indicating whether the user-entered content in the specified control passes validation.


When implemented by a class, evaluates the condition it checks and updates the IsValid property.

Classes that implement this interface represent a possible user input error. When the Validate method is called, the class updates its IsValid property to signify whether the error occurred. The ErrorMessage property contains a text description of the error condition that you can display when the error occurs.

The BaseValidator class implements this interface, and all other ASP.NET validation server control classes inherit from BaseValidator. For information on validation server controls and how they work, see ASP.NET Validation Controls.

For details on how to develop custom ASP.NET validation server controls, see How to: Validate with a Custom Function for ASP.NET Server Controls.

System_CAPS_security Security Note

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft