ValidationHelper.Validate Method

Performs validation on elements registered for validation, and optionally lets you specify a list of fields to check.

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

public IEnumerable<ValidationResult> Validate(
	params string[] fields


Type: System.String[]
Optional. The names (value of the name attribute) of the user input elements to validate. You can specify any number of element names, separated by commas. If you do not specify a list, the method validates all registered elements.

Return Value

Type: System.Collections.Generic.IEnumerable<ValidationResult>
The list of errors for the specified fields, if any validation errors occurred.

You typically do not need to call this method. Validation is automatically performed when the page is submitted. However, you can call it if you want to perform validation on an individual field, if a value has been changed programmatically, or under some other condition where automatic validation is not sufficient.