
Good question Kumar...
Peek is the combination of Retrieval and Keep method, let's try to understand this with an example.
Keep - Look at following code snippet, we have called the Keep method just after reading the TempData. In this case, Keep method instruct the MVC that retain the value of TempData for next request
string data = TempData["MyTempData"].ToString();
TempData.Keep("MyTempData"); // above like is mandatory
Peek - In case we want to retrieve data from TempData and retain them for next request, we can directly use Peek instead of above code snippet.
So Peek is the combination of retrieval and Keep method (above code snippet)
string data = TempData.Peek("MyTempData").ToString();
You can read the complete tutorials at
http://techfunda.com/howto/236/pass-data-from-one-action-method-to-another that is also written by me.
Hope this helps.
Thanks
Regards,
Sheo Narayan
http://www.dotnetfunda.com
Kumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator