Hi,
I have created a custom tag helper named "asp-disabled" with a target element set to "input" tag:
[HtmlTargetElement("input")] public class AspDisabledTagHelper : TagHelper { private const string AspDisabledAttributeName = "asp-disabled"; [HtmlAttributeName(AspDisabledAttributeName)] public bool IsDisabled { set; get; } public override void Process(TagHelperContext context, TagHelperOutput output) { if (IsDisabled) { output.Attributes.Add(new TagHelperAttribute("disabled", "disabled")); } base.Process(context, output); } }
Razor engine executes Process method for every encountered "input" tag, even if the latter doesn't have specified "asp-disabled" attribute. I'm wondering is this a correct behavior or am I missing something in tag declaration.