MVC Partial页面的使用
先建立Action:
- public PartialViewResult CurrentCount()
- {
- ViewBag.Count = CurrentUserCount;
- return PartialView();
- }
然后在页面引用:
- @Html.Action("CurrentCount","Base")
对应的部分页HTML:
- <h2>@ViewBag.Count</h2>
------------------
------------------