HtmlHelperValidationExtensions.ValidationMessage 方法

定义

重载

ValidationMessage(IHtmlHelper, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

ValidationMessage(IHtmlHelper, String, Object)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

ValidationMessage(IHtmlHelper, String, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

ValidationMessage(IHtmlHelper, String, String, Object)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

ValidationMessage(IHtmlHelper, String, String, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

ValidationMessage(IHtmlHelper, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ ValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression);
public static Microsoft.AspNetCore.Html.IHtmlContent ValidationMessage (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression);
static member ValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function ValidationMessage (htmlHelper As IHtmlHelper, expression As String) As IHtmlContent

参数

htmlHelper
IHtmlHelper

IHtmlHelper此方法扩展的实例。

expression
String

相对于当前模型的表达式名称。

返回

包含 ValidationMessageElement 元素的新 IHtmlContent 。 如果 expression 有效且禁用客户端验证,则为空IHtmlContent

注解

方法从 ModelStateDictionary 对象中提取错误字符串。 消息将始终可见,但客户端验证可能会更新关联的 CSS 类。

适用于

ValidationMessage(IHtmlHelper, String, Object)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ ValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::Object ^ htmlAttributes);
public static Microsoft.AspNetCore.Html.IHtmlContent ValidationMessage (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object htmlAttributes);
static member ValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function ValidationMessage (htmlHelper As IHtmlHelper, expression As String, htmlAttributes As Object) As IHtmlContent

参数

htmlHelper
IHtmlHelper

IHtmlHelper此方法扩展的实例。

expression
String

相对于当前模型的表达式名称。

htmlAttributes
Object

一个 Object ,其中包含 (ValidationMessageElement) 元素的 HTML 属性。 或者,一个 IDictionary<TKey,TValue> 包含 HTML 属性的 实例。

返回

包含 ValidationMessageElement 元素的新 IHtmlContent 。 如果 expression 有效且禁用客户端验证,则为空IHtmlContent

注解

方法从 ModelStateDictionary 对象中提取错误字符串。 消息将始终可见,但客户端验证可能会更新关联的 CSS 类。

适用于

ValidationMessage(IHtmlHelper, String, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ ValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::String ^ message);
public static Microsoft.AspNetCore.Html.IHtmlContent ValidationMessage (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, string message);
static member ValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function ValidationMessage (htmlHelper As IHtmlHelper, expression As String, message As String) As IHtmlContent

参数

htmlHelper
IHtmlHelper

IHtmlHelper此方法扩展的实例。

expression
String

相对于当前模型的表达式名称。

message
String

要显示的消息。 如果 null 或 为空,则方法从 ModelStateDictionary 对象中提取错误字符串。 消息将始终可见,但客户端验证可能会更新关联的 CSS 类。

返回

包含 ValidationMessageElement 元素的新 IHtmlContent 。 如果 expression 有效且禁用客户端验证,则为空IHtmlContent

适用于

ValidationMessage(IHtmlHelper, String, String, Object)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ ValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::String ^ message, System::Object ^ htmlAttributes);
public static Microsoft.AspNetCore.Html.IHtmlContent ValidationMessage (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, string message, object htmlAttributes);
static member ValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function ValidationMessage (htmlHelper As IHtmlHelper, expression As String, message As String, htmlAttributes As Object) As IHtmlContent

参数

htmlHelper
IHtmlHelper

IHtmlHelper此方法扩展的实例。

expression
String

相对于当前模型的表达式名称。

message
String

要显示的消息。 如果 null 或 为空,则方法从 ModelStateDictionary 对象中提取错误字符串。 消息将始终可见,但客户端验证可能会更新关联的 CSS 类。

htmlAttributes
Object

一个 Object ,其中包含 (ValidationMessageElement) 元素的 HTML 属性。 或者,一个 IDictionary<TKey,TValue> 包含 HTML 属性的 实例。

返回

包含 ValidationMessageElement 元素的新 IHtmlContent 。 如果 expression 有效且禁用客户端验证,则为空IHtmlContent

适用于

ValidationMessage(IHtmlHelper, String, String, String)

如果指定 expression的 对象中ModelStateDictionary存在错误,则返回验证消息。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ ValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::String ^ message, System::String ^ tag);
public static Microsoft.AspNetCore.Html.IHtmlContent ValidationMessage (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, string message, string tag);
static member ValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * string * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function ValidationMessage (htmlHelper As IHtmlHelper, expression As String, message As String, tag As String) As IHtmlContent

参数

htmlHelper
IHtmlHelper

IHtmlHelper此方法扩展的实例。

expression
String

相对于当前模型的表达式名称。

message
String

要显示的消息。 如果 null 或 为空,则方法从 ModelStateDictionary 对象中提取错误字符串。 消息将始终可见,但客户端验证可能会更新关联的 CSS 类。

tag
String

要在生成的 HTML 中包装 的 message 标记。 它的默认值为 ValidationMessageElement

返回

包含 tag 元素的新 IHtmlContent 。 如果 expression 有效且禁用客户端验证,则为空IHtmlContent

适用于