FormContext.GetValidationMetadataForField Method (String, Boolean)

Retrieves the validation value for the specified input field and a value that indicates what to do if the validation value is not found.

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

Syntax

'Declaration
Public Function GetValidationMetadataForField ( _
    fieldName As String, _
    createIfNotFound As Boolean _
) As FieldValidationMetadata
public FieldValidationMetadata GetValidationMetadataForField(
    string fieldName,
    bool createIfNotFound
)
public:
FieldValidationMetadata^ GetValidationMetadataForField(
    String^ fieldName, 
    bool createIfNotFound
)

Parameters

  • fieldName
    Type: System.String
    The name of the field to retrieve the validation value for.
  • createIfNotFound
    Type: System.Boolean
    true to create a validation value if one is not found; otherwise, false.

Return Value

Type: System.Web.Mvc.FieldValidationMetadata
The value to validate the field input with.

Exceptions

Exception Condition
ArgumentException

The fieldName parameter is either null reference (Nothing in Visual Basic) or empty.

See Also

Reference

FormContext Class

GetValidationMetadataForField Overload

System.Web.Mvc Namespace