Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

LabelTagHelper.cs

using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;

namespace Nop.Web.Framework.TagHelpers.Public;

/// 
/// "label" tag helper
/// 
[HtmlTargetElement("label", Attributes = FOR_ATTRIBUTE_NAME)]
public partial class LabelTagHelper : Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper
{
    #region Constants

    protected const string FOR_ATTRIBUTE_NAME = "asp-for";
    protected const string POSTFIX_ATTRIBUTE_NAME = "asp-postfix";

    #endregion

    #region Ctor

    public LabelTagHelper(IHtmlGenerator generator) : base(generator)
    {
    }

    #endregion

    #region Methods

    /// 
    /// Asynchronously executes the tag helper with the given context and output
    /// 
    /// Contains information associated with the current HTML tag
    /// A stateful HTML element used to generate an HTML tag
    /// A task that represents the asynchronous operation
    public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
    {
        ArgumentNullException.ThrowIfNull(context);

        ArgumentNullException.ThrowIfNull(output);

        output.Content.Append(Postfix);

        await base.ProcessAsync(context, output);
    }

    #endregion

    #region Properties

    /// 
    /// Indicates whether the input is disabled
    /// 
    [HtmlAttributeName(POSTFIX_ATTRIBUTE_NAME)]
    public string Postfix { get; set; }

    #endregion
}