ModelMetadata.GetValidators Method (ControllerContext)

 

Gets a list of validators for the model.

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

Syntax

public virtual IEnumerable<ModelValidator> GetValidators(
    ControllerContext context
)
public:
virtual IEnumerable<ModelValidator^>^ GetValidators(
    ControllerContext^ context
)
abstract GetValidators : 
        context:ControllerContext -> IEnumerable<ModelValidator>
override GetValidators : 
        context:ControllerContext -> IEnumerable<ModelValidator>
Public Overridable Function GetValidators (
    context As ControllerContext
) As IEnumerable(Of ModelValidator)

Parameters

Return Value

Type: System.Collections.Generic.IEnumerable<ModelValidator>

A list of validators for the model.

Remarks

Use this method to retrieve the validators that are applicable for this model. The validators can be used to run server-side validation on this model or to generate the client-side validation rules.

See Also

ModelMetadata Class
System.Web.Mvc Namespace

Return to top