Sandeep Kumar
What is syntax for Tempdata in MVC ?
By Sandeep Kumar in .NET on Dec 26 2015
  • Ritesh Singh
    Aug, 2016 4

    ******* Set Temp Data *********** public ActionResult Index() {var model = new Test(){Name = "ABC",Salary=5000};TempData["ModelName"] = model;return RedirectToAction("About"); }******* Get Temp Data *********** public ActionResult About() { var model= TempData["ModelName"]; return View(model); }

    • 0
  • Ritesh Singh
    Aug, 2016 4

    Hi,******* Set Temp Data public ActionResult Index() {var model = new Test(){Name = "ABC",Salary=5000};TempData["ModelName"] = model;return RedirectToAction("About"); }******* Get Temp Data public ActionResult About() { var model= TempData["ModelName"]; return View(model); }Note: Please accept the answer if it help you and answer your question.Thanks & Regards, Ritesh

    • 0
  • Sandeep Kumar
    Dec, 2015 26

    The syntax for Tempdata in MVC is Tempdata["variable "]=value;

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS