ValidationExtensions::Validate Method

Visual Studio 2010

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:
static void Validate(
	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 nullptr.

Client validation must be enabled.

Community Additions

ADD
Show: