OptionTagHelper OptionTagHelper OptionTagHelper Class


ITagHelper implementation targeting <option> elements.

public class OptionTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
type OptionTagHelper = class
    inherit TagHelper
Public Class OptionTagHelper
Inherits TagHelper


This ITagHelper works in conjunction with SelectTagHelper. It reads elements content but does not modify that content. The only modification it makes is to add a selected attribute in some cases.


OptionTagHelper(IHtmlGenerator) OptionTagHelper(IHtmlGenerator) OptionTagHelper(IHtmlGenerator)

Creates a new OptionTagHelper.


Generator Generator Generator
Order Order Order
Value Value Value

Specifies a value for the <option> element.

ViewContext ViewContext ViewContext


Init(TagHelperContext) Init(TagHelperContext) Init(TagHelperContext)

Initializes the ITagHelper with the given context. Additions to Items should be done within this method to ensure they're added prior to executing the children.

(Inherited from TagHelper)
Process(TagHelperContext, TagHelperOutput) Process(TagHelperContext, TagHelperOutput) Process(TagHelperContext, TagHelperOutput)

Synchronously executes the TagHelper with the given context and output.

(Inherited from TagHelper)
ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput) ProcessAsync(TagHelperContext, TagHelperOutput)

Applies to