ViewBag and ViewData | Part - 06 | Learn Razor using ASP.Net MVC | Tutorials Team

preview_player
Показать описание
ViewBag and ViewData
##############################
Both of them used to transfer values between views & controllers.
Defined in ControllerBase class.

ViewBag is type of dynamic, which allow store data into dynamic property for object.
ViewData is type of ViewDataDictionary, which store data with key value pair.

Both of them does not generate any compile time errors if we are misspell any property or key.

View Beg data are stored into View Data's dictionary internally.
Рекомендации по теме