title: Original values sometimes remain after edit and reload
body: <p>MVC5 web app.  I have a basic Edit method:</p>
  
  <pre><code>    public ActionResult Edit(int StudentId)
      {
          StudentModel model = repo.GetStudent(StudentId);
          return PartialView("_EditLot", model);
      }
  </code></pre>
  
  <p>and save the post:</p>
  
  <pre><code>    [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Edit(StudentModel model)
      {
          repo.UpdateStudent(model);
          return RedirectToAction("Index", "Subject", new { SubjectId = model.StudentId });
      }
  </code></pre>
  
  <p>So I post the edit, save the data in the repo then direct it back to the Index method so it reloads (index contains the student list for that subject with the edit link in the table for each student).</p>
  
  <pre><code>    public ActionResult Index(int ClassId)
      {
           ClassViewModel model = new ClassDataViewModel()
           {
               StudentList = repo.GetStudents(ClassId)
           };
           return View(model);
      }
  </code></pre>
  
  <p>EDIT:  Index view has a table of student data:</p>
  
  <pre><code>@model MyApp.Models.SubjectViewModel
  
  &lt;table class="table table-responsive processor-data-table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;
                  First Name
              &lt;/th&gt;
              &lt;th&gt;
                  Last Name
              &lt;/th&gt;
              &lt;th&gt;
                  DOB
              &lt;/th&gt;
              &lt;th&gt;
                  Grade
              &lt;/th&gt;
              &lt;th&gt;Edit&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          for (var i = 0; i &lt; Model.StudentList.Count(); i++)
          {
              &lt;tr&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; Model.StudentList[i].FirstName)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; Model.StudentList[i].LastName)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; Model.StudentList[i].DOB)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; Model.StudentList[i].Grade)
                  &lt;/td&gt;
                      &lt;a href="@Url.Action("Edit", "Student", new { @StudentId = Model.StudentList[i].StudentID })" class="btn btn-info modal-link"&gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;&lt;/a&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I often found the original values were still showing after the save and reload when testing in chrome and IE 10 or higher.  For example I changed the DOB for a student and sometimes the original DOB remains int he Index table after reload.</p>
  
  <p>I had been pressing Enter to submit the form and I suspected the Enter key was triggering the cancel button but the cancel button is of type="button" so I don't think that is possible.</p>
  
  <p>I then added this to the Edit method (not the post) and it fixed the issue in chrome:</p>
  
  <pre><code>    [OutputCache(Location = System.Web.UI.OutputCacheLocation.None, NoStore = true)]
  </code></pre>
  
  <p>... but I am still getting intermittent old values on the Index view in IE, out of 10 tests, 3 times I will have old values in the index list.</p>
  
  <p>EDIT: Some asked to see the repo update method:</p>
  
  <pre><code>public void UpdateStudent(StudentModel model)
  {
      using (var db = new SchoolEntities())
      {
          Student student = new Student()
          {
              StudentID = model.StudentID,
              FirstName = model.FirstName,
              LastName = model.LastName,
              Grade = model.Grade,
              DOB = model.DOB
          };
  
          db.Entry(student).State = System.Data.Entity.EntityState.Modified;
          db.SaveChanges();
      }
  }
  </code></pre>