Export (0) Print
Expand All

ValidationExtensions.Validate Method

.NET Framework 4

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)

public static void Validate(
	this HtmlHelper htmlHelper,
	string modelName
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper
The HTML helper instance that this method extends.
modelName
Type: System.String
The name of the property or model object that is being validated.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

ExceptionCondition
ArgumentNullException

The modelName parameter is null.

Client validation must be enabled.

Community Additions

ADD
Show:
© 2014 Microsoft