Dela via


HtmlHelperValidationExtensions.ValidationMessage Method

Definition

Overloads

ValidationMessage(IHtmlHelper, String)

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

ValidationMessage(IHtmlHelper, String, Object)

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

ValidationMessage(IHtmlHelper, String, String)

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

ValidationMessage(IHtmlHelper, String, String, Object)

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

ValidationMessage(IHtmlHelper, String, String, String)

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

ValidationMessage(IHtmlHelper, String)

Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

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

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

Returns

A new IHtmlContent containing a ValidationMessageElement element. An empty IHtmlContent if the expression is valid and client-side validation is disabled.

Remarks

Method extracts an error string from the ModelStateDictionary object. Message will always be visible but client-side validation may update the associated CSS class.

Applies to

ValidationMessage(IHtmlHelper, String, Object)

Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

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

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

htmlAttributes
Object

An Object that contains the HTML attributes for the (ValidationMessageElement) element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

A new IHtmlContent containing a ValidationMessageElement element. An empty IHtmlContent if the expression is valid and client-side validation is disabled.

Remarks

Method extracts an error string from the ModelStateDictionary object. Message will always be visible but client-side validation may update the associated CSS class.

Applies to

ValidationMessage(IHtmlHelper, String, String)

Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

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

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

message
String

The message to be displayed. If null or empty, method extracts an error string from the ModelStateDictionary object. Message will always be visible but client-side validation may update the associated CSS class.

Returns

A new IHtmlContent containing a ValidationMessageElement element. An empty IHtmlContent if the expression is valid and client-side validation is disabled.

Applies to

ValidationMessage(IHtmlHelper, String, String, Object)

Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

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

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

message
String

The message to be displayed. If null or empty, method extracts an error string from the ModelStateDictionary object. Message will always be visible but client-side validation may update the associated CSS class.

htmlAttributes
Object

An Object that contains the HTML attributes for the (ValidationMessageElement) element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

A new IHtmlContent containing a ValidationMessageElement element. An empty IHtmlContent if the expression is valid and client-side validation is disabled.

Applies to

ValidationMessage(IHtmlHelper, String, String, String)

Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs
Source:
HtmlHelperValidationExtensions.cs

Returns the validation message if an error exists in the ModelStateDictionary object for the specified expression.

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

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

message
String

The message to be displayed. If null or empty, method extracts an error string from the ModelStateDictionary object. Message will always be visible but client-side validation may update the associated CSS class.

tag
String

The tag to wrap the message in the generated HTML. Its default value is ValidationMessageElement.

Returns

A new IHtmlContent containing a tag element. An empty IHtmlContent if the expression is valid and client-side validation is disabled.

Applies to