首页 > 代码库 > MVC View 页面手动传递参数显示数据

MVC View 页面手动传递参数显示数据

Controller页面:
public ActionResult Index(string name, int numTimes)      {          ViewBag.Message = "Hello " + name;          ViewBag.NumTimes = numTimes;          return View();      }

View页面:
<body>    <ul>        @for (int i = 0; i < ViewBag.NumTimes; i++)        {            <li>                @ViewBag.message            </li>        }    </ul></body>

MVC View 页面手动传递参数显示数据