Last post Jul 21, 2014 07:33 AM by syed.abbas548
Jul 21, 2014 04:56 AM|arathirs|LINK
please any tell me what is the difference between a temp data and view bag?
Jul 21, 2014 04:58 AM|aruvirs|LINK
Viewbag is used to communicate between controller and corresponding view. But this communication is only for server call, it becomes null
if redirect occurs. So, in short, it's a mechanism to maintain state between controller and corresponding view.ViewBag is a dynamic property and doesn't have typecasting and null checks.
And now talking about TempData,it is also a dictionary object that stays for the time of an HTTP Request. So,Tempdata can be used to maintain data between redirects, i.e., from one controller to the other controller.
Jul 21, 2014 07:33 AM|syed.abbas548|LINK
ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0.
ViewBag doesn’t require typecasting for complex data type.