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";
  }
<input id="test"/>
@section scripts{
 $(function () {
$("#test").val(ViewBag.Ccuser);
 });
 }

猜你喜欢

转载自blog.csdn.net/lemonemmm/article/details/90106309
今日推荐