ValidationExtensions.ValidateFor<TModel,TProperty> Method

Definition

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

public static void ValidateFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression);
static member ValidateFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> -> unit
<Extension()>
Public Sub ValidateFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)))

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

Applies to