ValidationHelper.Add Method (String, IValidator[])

Registers a user input element for validation.

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

public function Add(
	field : String, 
	... validators : IValidator[]


Type: System.String
The name (value of the name attribute) of the user input element to validate.
Type: System.Web.WebPages.IValidator[]
A list of one or more types of validation to register.

You can register the same user input element multiple times using different validation types. For example, you can register an element to be required and also the have a range or string length. However, you can only register a user input element once for a specific type of validation. For example, you can call this method in the following ways:

Validation.Add("description", Validator.Required(), Validator.StringLength(5));