MVC ViewBag.xxxx 后端传值到前端

Controller

 public ActionResult Index()
        {
         ViewBag.Ccuser = xxxx;
            return View();
        }

cshtml 将值付给input

@using Lead.Objects.Domain
@using Lead.OA.Utils
@{
    Layout = "~/Views/Shared/_List.cshtml";
  }

@section scripts{
 $(function () {
$("#test").val(ViewBag.Ccuser);
 });
 }

你可能感兴趣的:(MVC)