title: Conditionally add markup based on model value
body: <p>How can I test the value of a Model.IsCopy and render the Part Num textbox if false?</p>
  
  <p>I tried using @Model.IsCopy but it's value is different than the value in @Html.HiddenFor(m=>m.IsCopy).  Seems @Model is the empty class while m is the value passed into the Partial View.</p>
  
  <pre><code>@Html.HiddenFor(m =&gt; m.PartNum)
  @Html.HiddenFor(m=&gt; m.IsCopy)
  &lt;table&gt;
      &lt;tr&gt;&lt;td colspan="2" align="center"&gt;&lt;h4 class="text-info"&gt; Details&lt;/h4&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td colspan="2" align="center"&gt; &lt;hr /&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;
          &lt;td width="30%"&gt;Part Num&lt;/td&gt;
          &lt;td&gt;
               @{ if (@Model.IsCopy == false)
                  {
                     @Html.TextBoxFor(m =&gt; m.PartNum,  new { ReadOnly = "true", Visibility = "true" })
                }
                  }
          &lt;/td&gt;                       
      &lt;/tr&gt;
  </code></pre>
  
  <p></p>
  
  <p>Inspecting in the browser shows the hidden field to be true but the Html.TextboxFor still renders.</p>
  
  <pre><code>&lt;input name="IsCopy" id="IsCopy" type="hidden" value="true" data-val-required="The IsCopy field is required." data-val="true" data-bind="value:IsCopy"&gt;
  </code></pre>