Share via


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)

Syntax

'Declaration
Public Function Validate ( _
    ParamArray fields As String() _
) As IEnumerable(Of ValidationResult)
'Usage
Dim instance As ValidationHelper 
Dim fields As String()
Dim returnValue As IEnumerable(Of ValidationResult)

returnValue = instance.Validate(fields)
public IEnumerable<ValidationResult> Validate(
    params string[] fields
)
public:
IEnumerable<ValidationResult^>^ Validate(
    ... array<String^>^ fields
)
member Validate : 
        fields:string[] -> IEnumerable<ValidationResult> 
public function Validate(
    ... fields : String[]
) : IEnumerable<ValidationResult>

Parameters

  • 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.

Remarks

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.

See Also

Reference

ValidationHelper Class

System.Web.WebPages Namespace