Add Method (String, IValidator[])
Collapse the table of content
Expand the table of content

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 Sub Add ( _
	field As String, _
	ParamArray validators As IValidator() _
Dim instance As ValidationHelper 
Dim field As String 
Dim validators As IValidator()

instance.Add(field, validators)


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));

© 2016 Microsoft