Share via


ValidationExtensions.Validate Method (HtmlHelper, String)

 

Retrieves the validation metadata for the specified model and applies each rule to the data field.

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

Syntax

public static void Validate(
    this HtmlHelper htmlHelper,
    string modelName
)
public:
[ExtensionAttribute]
static void Validate(
    HtmlHelper^ htmlHelper,
    String^ modelName
)
static member Validate : 
        htmlHelper:HtmlHelper *
        modelName:string -> unit
<ExtensionAttribute>
Public Shared Sub Validate (
    htmlHelper As HtmlHelper,
    modelName As String
)

Parameters

  • modelName
    Type: System.String

    The name of the property or model object that is being validated.

Exceptions

Exception Condition
ArgumentNullException

The modelName parameter is null.

Remarks

Client validation must be enabled.

See Also

ValidationExtensions Class
System.Web.Mvc.Html Namespace

Return to top