ASP.NET MVC 四种传值方法
发布时间:2016-09-09 00:00:10
1.后台传值: 1 public class DataController : Controller 2 { 3 // GET: Data 4 public ActionResult Index() 5 { 6 //1 ViewData传值 ...
1.后台传值:
1 public class DataController : Controller 2 { 3 // GET: Data 4 public ActionResult Index() 5 { 6 //1 ViewData传值 7 ViewData["name1"] = "张三"; 8 9 //2 ViewBag.name 10 ViewBag.name = "李四"; 11 12 //3.TempData["name"] 13 TempData["name"] = "王五"; 14 15 //4 view传值直接 16 PersonViewModel model = new PersonViewModel() { Name="赵六", Age=18}; 17 return View(model); 18 } 19 }
原标题:ASP.NET MVC 四种传值方法
关键词:ASP.NET
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。
黄山最好旅行社:https://www.vstour.cn/t/黄山最好旅行社.html
黄山最佳旅游线路:https://www.vstour.cn/t/黄山最佳旅游线路.html
黄胜记:https://www.vstour.cn/t/黄胜记.html
黄石5日游:https://www.vstour.cn/t/黄石5日游.html
黄石公园二日游路线:https://www.vstour.cn/t/黄石公园二日游路线.html
黄石公园攻略:https://www.vstour.cn/t/黄石公园攻略.html
珠海长隆横琴剧院票价是多少:https://www.vstour.cn/a/335166.html
珠海长隆横琴剧院交通指引:https://www.vstour.cn/a/335167.html