Export (0) Print
Expand All

ValidationExtensions.Validate Method

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 http://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or http://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

ExceptionCondition
ArgumentNullException

The modelName parameter is null.

Client validation must be enabled.

Show:
© 2014 Microsoft