DefaultValidationHtmlAttributeProvider.AddValidationAttributes 方法

定义

如果启用了客户端验证,则 attributes 向 添加与验证相关的 HTML 属性。

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

参数

viewContext
ViewContext

ViewContext当前范围的实例。

modelExplorer
ModelExplorer

ModelExplorer表达式的 。

attributes
IDictionary<String,String>

Dictionary<TKey,TValue> 接收验证属性的 。 将验证属性名称映射到其 String 值。 在将值写入 HTML 文档或响应之前,值必须经过 HTML 编码。

适用于