Bagikan melalui


DefaultHtmlGenerator.GenerateValidationMessage Metode

Definisi

tag Buat elemen jika viewContextberisi ModelState kesalahan untuk expression.

public:
 virtual 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 virtual 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
override this.GenerateValidationMessage : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * string * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
Public Overridable Function GenerateValidationMessage (viewContext As ViewContext, modelExplorer As ModelExplorer, expression As String, message As String, tag As String, htmlAttributes As Object) As TagBuilder

Parameter

viewContext
ViewContext

Instans ViewContext untuk cakupan saat ini.

modelExplorer
ModelExplorer

ModelExplorer untuk expression.

expression
String

Nama ekspresi, relatif terhadap model saat ini.

message
String

Pesan yang akan ditampilkan. Jika null atau kosong, metode mengekstrak string kesalahan dari ModelStateDictionary objek . Pesan akan selalu terlihat tetapi validasi sisi klien dapat memperbarui kelas CSS terkait.

tag
String

Tag untuk membungkus message dalam HTML yang dihasilkan. Nilai defaultnya adalah ValidationMessageElement.

htmlAttributes
Object

Yang Object berisi atribut HTML untuk elemen . Atau, instans yang IDictionary<TKey,TValue> berisi atribut HTML.

Mengembalikan

Penerapan

Berlaku untuk