title: Asp.net mvc calculated field in edit form
body: <p>I'm trying to create asp.net mvc aplication. In worker.cs class I have added these parameters:</p>
  
  <pre><code> public class Worker
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public string Surname { get; set; }
      public double Net { get; set; }
      [Editable(false)][NotMapped]
      public double Gross
      {
          get {
              if (Net &lt;= 282.10 &amp;&amp; Net &gt; 0)
                  return Math.Round(Net / 0.91, 2);
              else if (Net &lt;= 335.30 &amp;&amp; Net &gt; 282.10)
                  return Math.Round((Net - 46.5) / 0.76, 2);
              else if (Net &lt;= 760 &amp;&amp; Net &gt; 335.3)
                  return Math.Round((Net - 75) / 0.685, 2);
              else if (Net &gt; 760)
                  return Math.Round((Net / 0.76), 2);
              else
                  return 0;
          }
  
      }
  }
  </code></pre>
  
  <p>Gross parameter should be readonly. My question is about edit form, I need to show <em>gross</em> value then user types <em>net</em> value (realtime).I have tried to use knockout.js, but I can't figure out how to do that.
  <a href="https://i.stack.imgur.com/3hDSR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3hDSR.png" alt="enter image description here"></a></p>
  
  <pre><code>div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Net, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EditorFor(model =&gt; model.Net, new { htmlAttributes = new { @class = "form-control", data_bind = "value: NetV, valueUpdate:'afterkeydown'" } })
                  @Html.ValidationMessageFor(model =&gt; model.Net, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Gross, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                 @Html.TextBoxFor(model =&gt; model.Gross, new { @class = "form-control", data_bind="value:GrossV",@readonly = "readonly", disabled = "disabled" })
  
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>