TagHelperOutputExtensions.CopyHtmlAttribute Method

Definition

Copies a user-provided attribute from context's AllAttributes to tagHelperOutput's Attributes.

public:
[System::Runtime::CompilerServices::Extension]
 static void CopyHtmlAttribute(Microsoft::AspNetCore::Razor::TagHelpers::TagHelperOutput ^ tagHelperOutput, System::String ^ attributeName, Microsoft::AspNetCore::Razor::TagHelpers::TagHelperContext ^ context);
public static void CopyHtmlAttribute (this Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput tagHelperOutput, string attributeName, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context);
static member CopyHtmlAttribute : Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput * string * Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext -> unit
<Extension()>
Public Sub CopyHtmlAttribute (tagHelperOutput As TagHelperOutput, attributeName As String, context As TagHelperContext)

Parameters

tagHelperOutput
TagHelperOutput

The TagHelperOutput this method extends.

attributeName
String

The name of the bound attribute.

Remarks

Only copies the attribute if tagHelperOutput's Attributes does not contain an attribute with the given attributeName.

Duplicate attributes same name in context's AllAttributes or tagHelperOutput's Attributes may result in copied attribute order not being maintained.

Applies to