https://stackify.com/viewbag/ In the case of ASP.NET MVC, you have three ways to pass data from the controller to the view. These are ViewBag, ViewData and TempData. ViewBag and ViewData are highly similar in the way they pass data from controller to…
ViewData属性 ViewData属性是System.Web.Mvc.ControllerBase中的一个属性,它相当于一个数据字典.Controller中向该字典写入数据,ViewData[“Key”]=data;View中从该字典中获取数据 int data=ViewData[“Key”].从ViewData中获取到的数据是object类型,必须强制类型转换. // // 摘要: Gets or sets the dictionary for view data. // 返回结果: Th…