Difference Between ViewBag,ViewData,TempData Part 2 - ASP.NET C# April 2020

preview_player
Показать описание
#linebreak #StayHome

Difference Between ViewBag,ViewData,TempData Part 2 - ASP.NET C# April 2020

ViewData and ViewBag Usage is almost similar. To Pass Data from controller to view. but in ViewData requires type casting for complex data types and checks for null values to avoid errors while in ViewBag It doesn’t require type casting for complex data types.

TempData is also a dictionary derived from TempDataDictionary class and stored in short lives session and it is a string key and object value.Unlike ViewBag And ViewData You Can Transfer Data From One Controller To Another Controller.
Рекомендации по теме