title: Rendering same View after Http Post in MVC
body: <p>Trying to repost a view but im getting null to the field I want.</p>
  
  <p>Heres the controller...</p>
  
  <pre><code>    public ActionResult Upload()
      {
          VMTest vm = new VMTest();
          return View(vm);
      }
  
      [HttpPost]
      public ActionResult Upload(VMTest vm, String submitButton)
      {
          if (submitButton == "Upload")
          {
              //do some processing and render the same view
              vm.FileName = "2222";           // dynamic creation of filename
              vm.File.SaveAs(@vm.FileName);   // save file to server
              return View(vm);
          }
          else if (submitButton == "Save")
          {
              //read the file from the server
              FileHelperEngine engine = new FileHelperEngine(typeof(PaymentUploadFile));
              PaymentUploadFile[] payments = (PaymentUploadFile[])engine.ReadFile(@vm.FileName);  // the problem lays here @vm.FileName has no value during upload
  
              //save the record of the file to db
              return View("Success");
          }
          else
          {
              return View("Error");
          }
      }
  </code></pre>
  
  <p>I already had a @Html.HiddenFor(model => Model.FileName) inside my view.</p>
  
  <p>But still I got a null value for Model.FileName.</p>
  
  <p>Any help pls</p>
  
  <p>Thanks</p>