标签:
Controller
public ActionResult Index(){List<string> colors = new List<string>();colors.Add("red");colors.Add("green");colors.Add("blue"); ViewData["listColors"] = colors;ViewData["dateNow"] = DateTime.Now;ViewData["name"] = "Hajan";ViewData["age"] = 25;return View();} |
Controller
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
public ActionResult Index(){List<string> colors = new List<string>();colors.Add("red");colors.Add("green");colors.Add("blue");ViewBag.ListColors = colors; //colors is ListViewBag.DateNow = DateTime.Now;ViewBag.Name = "Hajan";ViewBag.Age = 25;return View(); } |
你和上面的对比 你看见了不同吗?


标签:
原文地址:http://www.cnblogs.com/Tmc-Blog/p/4518383.html