HtmlAttributeNameAttribute Class

Used to override an Microsoft.AspNetCore.Razor.TagHelpers.ITagHelper property’s HTML attribute name.

Namespace
Microsoft.AspNetCore.Razor.TagHelpers
Assemblies
  • Microsoft.AspNetCore.Razor.Runtime

Syntax

[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class HtmlAttributeNameAttribute : Attribute, _Attribute
class Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute

Constructors

HtmlAttributeNameAttribute()

Instantiates a new instance of the Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute class with Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.Name equal to <code>null</code>.

public HtmlAttributeNameAttribute()
HtmlAttributeNameAttribute(System.String)

Instantiates a new instance of the Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute class.

Arguments:name (System.String) – HTML attribute name for the associated property. Must be <code>null</code> or empty if associated property does not have a public setter and is compatible with System.Collections.Generic.IDictionary`2 where <code>TKey</code> is System.String. Otherwise must not be <code>null</code> or empty.
public HtmlAttributeNameAttribute(string name)

Properties

Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix

Gets or sets the prefix used to match HTML attribute names. Matching attributes are added to the associated property (an System.Collections.Generic.IDictionary`2).

Return type:System.String
Returns:<p> If associated property is compatible with System.Collections.Generic.IDictionary`2, default value is <code>Name + “-“</code>. Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.Name must not be <code>null</code> or empty in this case. </p> <p> Otherwise default value is <code>null</code>. </p>
public string DictionaryAttributePrefix { get; set; }
Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefixSet

Gets an indication whether Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix has been set. Used to distinguish an uninitialized Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix value from an explicit <code>null</code> setting.

Return type:System.Boolean
Returns:<code>true</code> if Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.DictionaryAttributePrefix was set. <code>false</code> otherwise.
public bool DictionaryAttributePrefixSet { get; }
Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute.Name

HTML attribute name of the associated property.

Return type:System.String
Returns:<code>null</code> or empty if and only if associated property does not have a public setter and is compatible with System.Collections.Generic.IDictionary`2 where <code>TKey</code> is System.String.
public string Name { get; }