Passing
Data from one action method to another action method
public ActionResult Index()
{
TempData.Add["MyTempData", "This is from calling method"]
return RedirectToAction("TempDataMethod")
}
public ActionResult TempDataMethod()
{
return Content(TempData["MyTempData"]).ToString();
}
Retaining TempData Value using Keep and Peek Methods
string data = TempData["MyTempData"].ToString();
Keep Method string data=TempData.Keep("MyTempData").Tostring();
Peek Method string data=TempData.Peek("MyTempData").ToString();