public ActionResult About()
{
ViewBag.Message = "Your application description page.";
//MVC5 view()直接输出字符串方式
//使用命名参数的方式
return View(model: "abcd123");
//return View(viewName:"About",model:"abcd123");
}
.cshtml
@model string @{ ViewBag.Title = "About"; } <h2>@ViewBag.Title.</h2> <h3>@Model.ToString()</h3>
<!--代表在母版页的section块所在的位置加入以下代码--> @section scripts{ <script> $('p').html('Welcome to dounai and douru!'); </script> }