Home > MVC > How to use TempData, Peek and Keep in ASP.NET MVC



How to use TempData, Peek and Keep in ASP.NET MVC

In this article, we will explore how to use TempData, Peek and Keep in ASP.NET MVC with an example.


In this article, we will explore how to use TempData, Peek and Keep in ASP.NET MVC with an example. We are using Keep method for retaining the value and Peek method for getting the stored value. TempData.Keep() and TempData.Peek() both are part of TempDataDictionary. TempData contains two methods keep() and peek() to maintain data from one controller action to the other controller action.

 

_Layout.Cshtml

 

 

Keep.cshtml

We retaining the data to TempData..

 

Peek.cshtml

We have read the data from TempData.

 

HomeController

 

Download




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*