title: How can I prevent EditorTemplate logic from overriding View logic?
body: <p>Using MVC5 I've added view logic to disable data entry based on a value in the model. After the logic runs it is overridden by existing EditorTemplate logic - the field remains enabled. How can I make my disable logic work? This view logic runs first:</p>
  
  <pre><code>&lt;div&gt;
      @{
          object attributes = new { @class = "form-control", @disabled = "disabled", @readonly = "readonly" };
  
          if (Model.OnHold.Number == 0) {
              attributes = new { @class = "form-control datePicker" };
          }
  
          @Html.EditorFor(model =&gt; model.OnHold.DateIssued, attributes);
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>Then the conflicting EditorTemplate code:</p>
  
  <pre><code>@model DateTime
  
  @Html.TextBox(string.Empty, @Model.ToString("MM/dd/yyyy"), new { @class = "form-control datepicker" })
  </code></pre>