ValidationExtensions.ValidationMessage Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ValidationMessage(HtmlHelper, String, String, Object, String) |
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String, IDictionary<String,Object>, String) |
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String, String) |
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String, Object) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String, IDictionary<String,Object>) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, Object, String) |
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, IDictionary<String,Object>, String) |
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, Object) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, IDictionary<String,Object>) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String) |
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object. |
ValidationMessage(HtmlHelper, String, String, Object, String)
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage, object htmlAttributes, string tag);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string * obj * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String, htmlAttributes As Object, tag As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method operates on.
- modelName
- String
The name of the entry being validated.
- validationMessage
- String
The message to display if the specified entry contains an error.
- htmlAttributes
- Object
An object that contains the HTML attributes for the element.
- tag
- String
The tag to be set for the wrapping HTML element of the validation message.
Returns
null if the entry is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessage(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 System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage, System.Collections.Generic.IDictionary<string,object> htmlAttributes, string tag);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string * System.Collections.Generic.IDictionary<string, obj> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String, htmlAttributes As IDictionary(Of String, Object), tag As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method operates on.
- modelName
- String
The name of the model object being validated.
- validationMessage
- String
The message to display if the specified entry contains an error.
- htmlAttributes
- IDictionary<String,Object>
An IDictionary<TKey,TValue> that contains the HTML attributes for the element.
- tag
- String
The tag to be set for the wrapping HTML element of the validation message.
Returns
null if the model object is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, String, String)
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage, string tag);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String, tag As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method operates on.
- modelName
- String
The name of the entry being validated.
- validationMessage
- String
The message to display if the specified entry contains an error.
- tag
- String
The tag to be set for the wrapping HTML element of the validation message.
Returns
null if the entry is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, String, Object)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage, object htmlAttributes);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String, htmlAttributes As Object) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
- validationMessage
- String
The message to display if the specified field contains an error.
- htmlAttributes
- Object
An object that contains the HTML attributes for the element.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, String, IDictionary<String,Object>)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
- validationMessage
- String
The message to display if the specified field contains an error.
- htmlAttributes
- IDictionary<String,Object>
An object that contains the HTML attributes for the element.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, Object, String)
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, object htmlAttributes, string tag);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * obj * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, htmlAttributes As Object, tag As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method operates on.
- modelName
- String
The name of the entry being validated.
- htmlAttributes
- Object
An object that contains the HTML attributes for the element.
- tag
- String
The tag to be set for the wrapping HTML element of the validation message.
Returns
null if the entry is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, IDictionary<String,Object>, String)
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, System.Collections.Generic.IDictionary<string,object> htmlAttributes, string tag);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * System.Collections.Generic.IDictionary<string, obj> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, htmlAttributes As IDictionary(Of String, Object), tag As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method operates on.
- modelName
- String
The name of the entry being validated.
- htmlAttributes
- IDictionary<String,Object>
An IDictionary<TKey,TValue> that contains the HTML attributes for the element.
- tag
- String
The tag to be set for the wrapping HTML element of the validation message.
Returns
null if the entry is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, String)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, string validationMessage);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, validationMessage As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
- validationMessage
- String
The message to display if the specified field contains an error.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, Object)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, object htmlAttributes);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, htmlAttributes As Object) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
- htmlAttributes
- Object
An object that contains the HTML attributes for the element.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String, IDictionary<String,Object>)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
- htmlAttributes
- IDictionary<String,Object>
An object that contains the HTML attributes for the element.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.
Applies to
ValidationMessage(HtmlHelper, String)
Displays a validation message if an error exists for the specified field in the ModelStateDictionary object.
public static System.Web.Mvc.MvcHtmlString ValidationMessage (this System.Web.Mvc.HtmlHelper htmlHelper, string modelName);
static member ValidationMessage : System.Web.Mvc.HtmlHelper * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessage (htmlHelper As HtmlHelper, modelName As String) As MvcHtmlString
Parameters
- htmlHelper
- HtmlHelper
The HTML helper instance that this method extends.
- modelName
- String
The name of the property or model object that is being validated.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.