What is the ViewBag? - ASP.NET MVC Demystified

ASP.NET MVC provides us with three ways to pass data from Controllers to Views. We've already discussed using TempData to create a FlashMessage partial. Now, let's discuss the second method available to us: ViewBag. What's in the Bag? ViewBag, according to MSDN, "enables you to dynamically share values from the controller to the view". The key word there is "dynamically"; ViewBag is of type dynamic. Essentially, they are a type where the actual type (e.... Read more >
/* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + ''; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }());