title: How to mimic the aspnet mvc code for LabelFor?
body: <p>My "unenhanced" code looks like this:</p>
  
  <pre><code>@using (Html.BeginForm("Index", "home"))
  {
      &lt;!-- old group --&gt;
      &lt;div class="form-group"&gt;
          @Html.LabelFor(m =&gt; m.Query.artist)        
          @Html.TextBoxFor(m =&gt; m.Query.artist, new { @class = "form-control" })
          @Html.ValidationMessageFor(m =&gt; m.Query.artist)
      &lt;/div&gt;
      ...
  }
  </code></pre>
  
  <p>But I want to enhance it and add a toggle feature for each <code>form-group</code>, like this:</p>
  
  <pre><code>&lt;script&gt;
      var toggleProperty = function(targetCheckbox) {
          var id = targetCheckbox.id.split('-')[0];
          var inputDiv = document.getElementById(id + "-inputdiv");
          inputDiv.style.display = (inputDiv.style.display !== "none") ? "none" : "";
      }
  &lt;/script&gt;
  
  &lt;!-- new group --&gt;
  &lt;input type="checkbox" id="property1-toggler" value="false" onchange="return toggleProperty(this)"/&gt; &lt;label for="property1"&gt;name for property1&lt;/label&gt;
  &lt;div id="property1-inputdiv"&gt;
      &lt;input class="form-control" id="property1" name="property1" type="text" value="property1 default value"&gt;
      &lt;span class="field-validation-valid" data-valmsg-for="property1" data-valmsg-replace="true"&gt;&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I would like to know where <a href="https://github.com/aspnet/Mvc" rel="nofollow noreferrer">in the aspnet mvc source code</a> I can find the code for <code>LabelFor</code> etc.</p>
  
  <p>This way I could better understand how it works, and create an extension function like:</p>
  
  <pre><code>public static IHtmlContent FullGroupFor&lt;TModel, TResult&gt;(this IHtmlHelper&lt;TModel&gt; htmlHelper, Expression&lt;Func&lt;TModel, TResult&gt;&gt; expression);
  </code></pre>