title: TagHelpers add custom class for LabelTagHelper based on validation attribute [Required]
body: <p>In Core MVC there is anew concept as Tag helpers.</p>
  <p>We could previously create custom html helpers to attach some classes based on the validation data annotations such as [Required].</p>
  <p>As TagHelpers arq quite new area I cannot find anough resources to achieve the following:</p>
  <p>here is the view model:</p>
  <pre><code>    [Required]
      public Gender Gender { get; set; }
  </code></pre>
  <p>view:</p>
  <pre><code>&lt;label class=&quot;control-label col-md-3 required&quot; asp-for=&quot;Gender&quot;&gt;&lt;/label&gt;
  </code></pre>
  <p>css:</p>
  <pre><code>.required:after {
  content: &quot;*&quot;;
  font-weight: bold;
  color: red;
  }
  </code></pre>
  <p>output:
  <a href="https://i.stack.imgur.com/LUYJ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LUYJ1.png" alt="enter image description here" /></a></p>
  <p>But I don't want to manully add the required css class in the label. Somehow I shoudl be able to extend the LabelTagHelper to read model data annotations and if it has the [Required] then add required class in the label element.</p>
  <p>Thanks,</p>