ValidationExtensions.ValidationMessageFor 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, Object, String) |
Returns the HTML markup for a validation-error message for the specified expression. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, IDictionary<String,Object>, String) |
Returns the HTML markup for a validation-error message for the specified expression. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, String) |
Returns the HTML markup for a validation-error message for the specified expression. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, Object) |
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, IDictionary<String,Object>) |
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String) |
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>) |
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression. |
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, Object, String)
Returns the HTML markup for a validation-error message for the specified expression.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage, object htmlAttributes, string tag);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string * obj * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String, htmlAttributes As Object, tag As String) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method operates on.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- validationMessage
- String
The message to display if a validation error occurs.
- 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 model object is valid and client-side validation is disabled. Otherwise, a tag
element that contains an error message.
Applies to
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, IDictionary<String,Object>, String)
Returns the HTML markup for a validation-error message for the specified expression.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage, System.Collections.Generic.IDictionary<string,object> htmlAttributes, string tag);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string * System.Collections.Generic.IDictionary<string, obj> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String, htmlAttributes As IDictionary(Of String, Object), tag As String) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method operates on.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- validationMessage
- String
The message to display if a validation error occurs.
- 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, String)
Returns the HTML markup for a validation-error message for the specified expression.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage, string tag);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String, tag As String) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method operates on.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- validationMessage
- String
The message to display if a validation error occurs.
- 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, Object)
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage, object htmlAttributes);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String, htmlAttributes As Object) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method extends.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String, IDictionary<String,Object>)
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method extends.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>, String)
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, string validationMessage);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), validationMessage As String) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method extends.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
- 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
ValidationMessageFor<TModel,TProperty>(HtmlHelper<TModel>, Expression<Func<TModel,TProperty>>)
Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression.
public static System.Web.Mvc.MvcHtmlString ValidationMessageFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression);
static member ValidationMessageFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ValidationMessageFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty))) As MvcHtmlString
Type Parameters
- TModel
The type of the model.
- TProperty
The type of the property.
Parameters
- htmlHelper
- HtmlHelper<TModel>
The HTML helper instance that this method extends.
- expression
- Expression<Func<TModel,TProperty>>
An expression that identifies the object that contains the properties to render.
Returns
If the property or object is valid, an empty string; otherwise, a span element that contains an error message.