2019独角兽企业重金招聘Python工程师标准>>>
//ControllerViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
// View<section class="featured"><div class="content-wrapper"><hgroup class="title"><h1>@ViewBag.Title.</h1><h2>@ViewBag.Message</h2></hgroup>...
第二种方法是viewdata
//Controller
public ActionResult Index(){ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";ViewData["TEST"] = "这是一个例子!";return View();}
<section class="featured"><div class="content-wrapper"><hgroup class="title"><h1>@ViewBag.Title.</h1><h2>@ViewBag.Message</h2><h2>@ViewData["TEST"]</h2></hgroup>
viewbag与viewdata区别
http://www.cnblogs.com/wintersun/archive/2012/01/21/2328563.html
看看着篇博文吧,很不错!