TempData Example in MVC

Use Of TempData



Code 

[Route("TempData")]
        public ActionResult mymethod4()
        {
            TempData["Mytemp"] = "My Temp Data";
            return View();
        }

csHTML


@{
    ViewBag.Title = "mymethod3";
}
@ViewData["viewdata"]
<h2>mymethod3</h2>
<h1>Temp Data   : @TempData["mytemp"]</h1>



Note : TempData is use to send one action method to another Action method. 

Comments

Popular posts from this blog

Search Record From Table Using jQuery in Asp.net core MVC

How To insert Radio Button Data in DataBase -- MVC

Toolbox Webparts Controls