1.后台传值:

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 }
View Code

相关文章:

  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
猜你喜欢
  • 2021-11-07
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案