Share via


IHtmlGenerator.GenerateValidationMessage メソッド

定義

の に tag のエラーがviewContextModelState含まれている場合は、 要素を生成しますexpression

public:
 Microsoft::AspNetCore::Mvc::Rendering::TagBuilder ^ GenerateValidationMessage(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, Microsoft::AspNetCore::Mvc::ViewFeatures::ModelExplorer ^ modelExplorer, System::String ^ expression, System::String ^ message, System::String ^ tag, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Mvc.Rendering.TagBuilder GenerateValidationMessage (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer modelExplorer, string expression, string message, string tag, object htmlAttributes);
abstract member GenerateValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * string * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
Public Function GenerateValidationMessage (viewContext As ViewContext, modelExplorer As ModelExplorer, expression As String, message As String, tag As String, htmlAttributes As Object) As TagBuilder

パラメーター

viewContext
ViewContext

現在の ViewContext スコープのインスタンス。

modelExplorer
ModelExplorer

ModelExplorerexpression

expression
String

現在のモデルを基準とした式名。

message
String

表示するメッセージ。 または空の場合 null 、メソッドは オブジェクトからエラー文字列を ModelStateDictionary 抽出します。 メッセージは常に表示されますが、クライアント側の検証では、関連付けられている CSS クラスが更新される可能性があります。

tag
String

生成された HTML で を message ラップするタグ。 既定値は ValidationMessageElement です。

htmlAttributes
Object

Object要素の HTML 属性を格納している 。 または、HTML 属性を IDictionary<TKey,TValue> 含むインスタンスです。

戻り値

注釈

ValidationMessageElement は既定では "span" です。

適用対象