Delen via


ValidationHtmlAttributeProvider.AddValidationAttributes Method

Definition

Adds validation-related HTML attributes to the attributes if client validation is enabled.

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

Parameters

viewContext
ViewContext

A ViewContext instance for the current scope.

modelExplorer
ModelExplorer

The ModelExplorer for an expression.

attributes
IDictionary<String,String>

The Dictionary<TKey,TValue> to receive the validation attributes. Maps the validation attribute names to their String values. Values must be HTML encoded before they are written to an HTML document or response.

Remarks

Adds nothing to attributes if client-side validation is disabled.

Applies to