ValidationExtensions.ValidationMessage Method

 

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

Namespace:   System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, IDictionary<String, Object>, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, Object)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, Object, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String, IDictionary<String, Object>, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String, Object)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String, Object, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

System_CAPS_pubmethodSystem_CAPS_staticValidationMessage(HtmlHelper, String, String, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	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.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	IDictionary<stringobject> htmlAttributes
)

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.

htmlAttributes
Type: System.Collections.Generic.IDictionary<StringObject>

An object that contains the HTML attributes for the element.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, IDictionary<String, Object>, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	IDictionary<stringobject> htmlAttributes,
	string tag
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper instance that this method operates on.

modelName
Type: System.String

The name of the entry being validated.

htmlAttributes
Type: System.Collections.Generic.IDictionary<StringObject>

An IDictionary<TKey, TValue> that contains the HTML attributes for the element.

tag
Type: System.String

The tag to be set for the wrapping HTML element of the validation message.

Return Value

Type: System.Web.Mvc.MvcHtmlString

null if the entry is valid and client-side validation is disabled. Otherwise, a tag element that contains an error message.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, Object)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	object htmlAttributes
)

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.

htmlAttributes
Type: System.Object

An object that contains the HTML attributes for the element.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, Object, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	object htmlAttributes,
	string tag
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper instance that this method operates on.

modelName
Type: System.String

The name of the entry being validated.

htmlAttributes
Type: System.Object

An object that contains the HTML attributes for the element.

tag
Type: System.String

The tag to be set for the wrapping HTML element of the validation message.

Return Value

Type: System.Web.Mvc.MvcHtmlString

null if the entry is valid and client-side validation is disabled. Otherwise, a tag element that contains an error message.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage
)

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.

validationMessage
Type: System.String

The message to display if the specified field contains an error.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage,
	IDictionary<stringobject> htmlAttributes
)

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.

validationMessage
Type: System.String

The message to display if the specified field contains an error.

htmlAttributes
Type: System.Collections.Generic.IDictionary<StringObject>

An object that contains the HTML attributes for the element.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String, IDictionary<String, Object>, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage,
	IDictionary<stringobject> htmlAttributes,
	string tag
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper instance that this method operates on.

modelName
Type: System.String

The name of the model object being validated.

validationMessage
Type: System.String

The message to display if the specified entry contains an error.

htmlAttributes
Type: System.Collections.Generic.IDictionary<StringObject>

An IDictionary<TKey, TValue> that contains the HTML attributes for the element.

tag
Type: System.String

The tag to be set for the wrapping HTML element of the validation message.

Return Value

Type: System.Web.Mvc.MvcHtmlString

null if the model object is valid and client-side validation is disabled. Otherwise, a tag element that contains an error message.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String, Object)

Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage,
	object htmlAttributes
)

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.

validationMessage
Type: System.String

The message to display if the specified field contains an error.

htmlAttributes
Type: System.Object

An object that contains the HTML attributes for the element.

Return Value

Type: System.Web.Mvc.MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

The ValidationMessage method renders a validation message if the specified field contains invalid input.

If the DefaultModelBinder instance cannot bind a form-field value to the model, the binder adds an error to the ModelState object. When the view is rendered, the validation messages and validation summary are displayed based on the Errors property of the ModelState object.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String, Object, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage,
	object htmlAttributes,
	string tag
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper instance that this method operates on.

modelName
Type: System.String

The name of the entry being validated.

validationMessage
Type: System.String

The message to display if the specified entry contains an error.

htmlAttributes
Type: System.Object

An object that contains the HTML attributes for the element.

tag
Type: System.String

The tag to be set for the wrapping HTML element of the validation message.

Return Value

Type: System.Web.Mvc.MvcHtmlString

null if the entry is valid and client-side validation is disabled. Otherwise, a tag element that contains an error message.

Return to top

ValidationExtensions.ValidationMessage Method (HtmlHelper, String, String, String)

Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.

public static MvcHtmlString ValidationMessage(
	this HtmlHelper htmlHelper,
	string modelName,
	string validationMessage,
	string tag
)

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper

The HTML helper instance that this method operates on.

modelName
Type: System.String

The name of the entry being validated.

validationMessage
Type: System.String

The message to display if the specified entry contains an error.

tag
Type: System.String

The tag to be set for the wrapping HTML element of the validation message.

Return Value

Type: System.Web.Mvc.MvcHtmlString

null if the entry is valid and client-side validation is disabled. Otherwise, a tag element that contains an error message.

Return to top
Show: