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

 

相关文章:

  • 2022-12-23
  • 2021-09-30
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
猜你喜欢
  • 2023-03-18
  • 2021-11-17
  • 2021-06-07
  • 2021-10-27
  • 2021-10-05
  • 2022-12-23
相关资源
相似解决方案