In this article you will learn about TempData in MVC 4.
Before reading this article, please go through the following article:
Let’s take one more step further in Session in MVC 4. Today, we will discuss about TempData. Hope readers remember about the following diagram. TempData TempData is used to share the data between controllers. TempData stays for a subsequent HTTP request.The value of TempData persists until it is read or until the current user’s session time out. Persisting data in TempData is useful in scenarios such as redirection, when values are needed beyond a single request. TempData stores the data in Session object. But the object gets destroyed earlier than session. An Example of TempData Step 1: Create an empty MVC 4 Project. Step 2: Right click on Modal, add new Modal name “Employee” and add the following code:
Hands on ASP.NET GridView