mvc html.validationmessage,ValidationExtensions.ValidationMessageFor Method (System.Web.Mvc.Html) | ...

ValidationExtensions.ValidationMessageFor Method

Definition

Assembly:System.Web.Mvc.dll

Package:Microsoft.AspNet.Mvc v5.2.6

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.

In this article

Overloads

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.

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.

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message.

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression.

ValidationMessageFor(HtmlHelper, Expression>, String, Object, String)

Returns the HTML markup for a validation-error message for the specified expression.

public static System.Web.Mvc.MvcHtmlString ValidationMessageFor (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage, object htmlAttributes, string tag);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string * obj * string -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method operates on.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

The message to display if a validation error occurs.

htmlAttributes

An object that contains the HTML attributes for the element.

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(HtmlHelper, Expression>, String, IDictionary, String)

Returns the HTML markup for a validation-error message for the specified expression.

public static System.Web.Mvc.MvcHtmlString ValidationMessageFor (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage, System.Collections.Generic.IDictionary htmlAttributes, string tag);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string * System.Collections.Generic.IDictionary * string -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method operates on.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

The message to display if a validation error occurs.

An IDictionary that contains the HTML attributes for the element.

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(HtmlHelper, Expression>, String, String)

Returns the HTML markup for a validation-error message for the specified expression.

public static System.Web.Mvc.MvcHtmlString ValidationMessageFor (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage, string tag);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string * string -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method operates on.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

The message to display if a validation error occurs.

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(HtmlHelper, Expression>, 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 (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage, object htmlAttributes);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string * obj -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method extends.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

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

htmlAttributes

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(HtmlHelper, Expression>, String, IDictionary)

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 (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage, System.Collections.Generic.IDictionary htmlAttributes);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string * System.Collections.Generic.IDictionary -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method extends.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

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

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(HtmlHelper, Expression>, 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 (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression, string validationMessage);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> * string -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method extends.

expression

Expression>

An expression that identifies the object that contains the properties to render.

validationMessage

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(HtmlHelper, Expression>)

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 (this System.Web.Mvc.HtmlHelper htmlHelper, System.Linq.Expressions.Expression> expression);

static member ValidationMessageFor : System.Web.Mvc.HtmlHelper * System.Linq.Expressions.Expression> -> System.Web.Mvc.MvcHtmlString

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

The HTML helper instance that this method extends.

expression

Expression>

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.

Applies to

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值