ValidationExtensions.ValidateFor(Of TModel, TProperty) Method (HtmlHelper(Of TModel), Expression(Of Func(Of TModel, TProperty)))

 

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)

<ExtensionAttribute>
Public Shared Sub ValidateFor(Of TModel, TProperty) (
	htmlHelper As HtmlHelper(Of TModel),
	expression As Expression(Of Func(Of TModel, TProperty))
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper(Of TModel)

The HTML helper instance that this method extends.

expression
Type: System.Linq.Expressions.Expression(Of Func(Of TModelTProperty))

An expression that identifies the object that contains the properties to render.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Client validation must be enabled.

Return to top
Show: