Freigeben über


ValidationHtmlAttributeProvider.AddAndTrackValidationAttributes Methode

Definition

Fügt validierungsbezogene HTML-Attribute hinzu, wenn die attributes Clientvalidierung aktiviert ist und validierungsattribute noch nicht in der aktuellen <Form> hinzugefügt expression wurden.

public:
 virtual void AddAndTrackValidationAttributes(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, Microsoft::AspNetCore::Mvc::ViewFeatures::ModelExplorer ^ modelExplorer, System::String ^ expression, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ attributes);
public virtual void AddAndTrackValidationAttributes (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer modelExplorer, string expression, System.Collections.Generic.IDictionary<string,string> attributes);
abstract member AddAndTrackValidationAttributes : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * System.Collections.Generic.IDictionary<string, string> -> unit
override this.AddAndTrackValidationAttributes : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * System.Collections.Generic.IDictionary<string, string> -> unit
Public Overridable Sub AddAndTrackValidationAttributes (viewContext As ViewContext, modelExplorer As ModelExplorer, expression As String, attributes As IDictionary(Of String, String))

Parameter

viewContext
ViewContext

Ein ViewContext instance für den aktuellen Bereich.

modelExplorer
ModelExplorer

Der ModelExplorer für den expression.

expression
String

Ausdrucksname relativ zum aktuellen Modell.

attributes
IDictionary<String,String>

Die Dictionary<TKey,TValue> , die die Validierungsattribute empfangen soll. Ordnet die Namen der Validierungsattribut ihren String Werten zu. Werte müssen HTML-codiert sein, bevor sie in ein HTML-Dokument oder eine Antwort geschrieben werden.

Hinweise

Verfolgt den expression in der aktuellen FormContext nach, um zu vermeiden, dass doppelte Validierungsattribute generiert werden. Das heißt, Validierungsattribute werden nur hinzugefügt, wenn kein vorheriger Aufruf sie für ein Feld mit diesem Namen im <Formular> hinzugefügt hat.

Gilt für: