Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
difference between view data & view bag in real time.
Posted

ViewBag[^] was introduced with MVC3. It is a property of type dynamic[^] (and not Object as the link is showing it) - available since framework version 4. It serves the same use as ViewData[^], but it is more convenient to use. You can use both, but they are not linked, they are two absolutely separate properties. In the background, both are dictionaries.
Som other literature: What is ViewData, ViewBag and TempData? – MVC options for passing data between current and subsequent request[^]
http://brendan.enrick.com/post/difference-between-viewbag-and-viewdata-in-mvc-3.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900