title: How to keep the values filled in a form and recover after navigating to another controller
body: <p>I am facing this situation. I have a form that I filled with three values. Then by clicking on a button I'm in another controller and I create an XmlDocument object I recovered via TempData. Once completed action coming back to my form naturally when all data has disappeared. My question is, how do I fill out the form, keep these values, and once the XML created to fill my database with the form data and XML created.</p>
  
  <p>Layout controller</p>
  
  <pre><code>public class LayoutController : Controller
  {
      [HttpGet]
      public ActionResult Create()
      {
          var Layout = new LayoutModel();
          return View(Layout);
      }
      [HttpPost]
      public ActionResult Create(LayoutModel Layout)
      {
          if (Layout == null)
          {
              return Content("le LayoutModel est nul");
          }
          else
          {
              TempData["DocName"] = Layout.Nom;         
              if (TempData["xmlAssociated"] != null)
              {
                  Layout.xmlAssociated = (string)TempData["xmlAssociated"];
                  ManageXML.Models.COracleConn.GetInstance().InsertLayout(Layout);
              }
              else
              {
                  return Content("On a pas recuperé l'XML");
              }
              return RedirectToAction("ListOfTopsAndMarges", "Entete_Marge");
          }
      }
  }
  </code></pre>
  
  <p>XMLRecord controller</p>
  
  <pre><code>public class XMLRecordController : Controller
  {
  
      [HttpGet]
      public ActionResult HandleForm()
      {
          var file = new XMLRecord()
          {
              Records = new List&lt;XMLRecord&gt;(){ new XMLRecord(){ Type="", Contenu="" }}
          };
          return View(file);
      }
  
      [HttpPost]
      public ActionResult HandleForm(XMLRecord file)
      {
          if (file == null)
          {
              return HttpNotFound();
          }
          else
          {
              file.DocName = (string)TempData["DocName"];
              string recup = file.GenerateXML(file);
              TempData["xmlAssociated"] = recup;
              return RedirectToAction("Create", "Layout");
          }         
      }
  }
  </code></pre>