Show / Hide Table of Contents

Method AddAndTrackValidationAttributes

| Improve this Doc View Source

AddAndTrackValidationAttributes(ViewContext, String, Column, IDictionary<String, String>)

Adds validation-related HTML attributes to the attributes if client validation is enabled and validation attributes have not yet been added for this column in the current <form>.

Declaration
public virtual void AddAndTrackValidationAttributes(ViewContext viewContext, string fullHtmlFieldName, Column column, IDictionary<string, string> attributes)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext

A Microsoft.AspNetCore.Mvc.Rendering.ViewContext instance for the current scope.

System.String fullHtmlFieldName

The full HTML field name.

Column column

The Column.

System.Collections.Generic.IDictionary<System.String, System.String> attributes

The System.Collections.Generic.Dictionary`2 to receive the validation attributes. Maps the validation attribute names to their System.String values. Values must be HTML encoded before they are written to an HTML document or response.

Remarks

Tracks the fullHtmlFieldName in the current Microsoft.AspNetCore.Mvc.Rendering.ViewContext to avoid generating duplicate validation attributes. That is, validation attributes are added only if no previous call has added them for a field with this name in the <form>.

  • Improve this Doc
  • View Source
Back to top Copyright © Weifen Luo | DevZest