Consumption of Data in MVC2 Views

The following data sources are implicitly available as properties of a View:

  • ViewData
  • ViewData.ModelState
  • ViewData.Model (or more simply just Model via a shortcut property)
  • TempData

TempData is a special case that has been previously covered. The other three all relate to ViewData, but are substantially different from each other. Understanding these differences is important; otherwise it can lead to unexpected behavior when reading and writing ViewData and Model values.

Continue reading “Consumption of Data in MVC2 Views”