title: Change value of EditorFor on DropDownFor value change
body: <p>I am trying to make an online bank website(for learning ASP.NET MVC).I have a class <strong>Account</strong></p>
  
  <pre><code>class Account
  {
  int account_id;
  String account_number;
  decimal balance;
  }
  </code></pre>
  
  <p>and I have a model for <strong>transaction</strong>.</p>
  
  <pre><code> public class MakeTransactionModel
      {
          [Required]
          public String AccountFrom { get; set; }
          [Required]
          public String AccountTo { get; set; }
  
          public Decimal OrignalBalance { get; set; }
          [Required]
          public Decimal Amount { get; set; }
          [Required]
          public String TransactionFor { get; set; }
      }
  </code></pre>
  
  <p>Then in controller, i am putting accounts in ViewBag.</p>
  
  <pre><code>ViewBag.account_from = new SelectList(db.Accounts, "account_id", "account_number");
  </code></pre>
  
  <p>In View, I created a drop down for showing all accounts</p>
  
  <pre><code>@Html.DropDownListFor(u =&gt; u.AccountFrom, (SelectList)ViewBag.account_from, htmlAttributes: new { @class = "form-control", @id = "AccountFrom", onchange=@"
                      @Model.OrignalBalance = 1000; // I tried this but did not work
                  " })
  </code></pre>
  
  <p>Now , I am trying to show <strong>balance</strong> of <strong>selected account</strong> in an EditorFor</p>
  
  <pre><code>@Html.EditorFor(model =&gt; model.OrignalBalance, new { htmlAttributes = new { @id="OrignalBalance", @class = "form-control", disabled = "disabled", @readonly = "readonly" } })
  </code></pre>
  
  <p>I have all accountsin <strong>ViewBag</strong> and I am showing that accounts number in drop down (those accounts also have balance in it). I am trying to change value of <strong>EditorFor</strong> on <strong>DropDownFor</strong> value change but still unable to do that. I tried to do that using jquery, but i don't know can I use <strong>LINQ</strong> in <strong>jquery</strong></p>
  
  <p>My jquery code is</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
  
          $(document).ready(function () {
              $(function () {
                  $('#AccountFrom').change(function () {
                      var selectedValue = $('#AccountFrom').text();
                      $('#OrignalBalance').val(@{new BankEntities().Accounts.SingleOrDefault(acc =&gt; acc.account_number == $('#AccountFrom').text())});   // I am trying to do this
                  });
              });
          }
      )
      &lt;/script&gt;
  </code></pre>
  
  <p>It will be good if i find a good solution to do that, so I can update EditorFor on change event. </p>
  
  <p>Thank you.</p>