@model IEnumerable<Ninesky.Models.UserGroup> @{ ViewBag.Title = "用户组列表"; Layout = "~/Views/Layout/_Manage.cshtml"; } <div> <div></div> 左侧列表 </div> <div></div> <div> <div> <div> <img alt="" src="https://www.jb51.net/~/Skins/Default/Manage/Images/UserGroup.gif" />用户组列表 </div> <div>@Html.ActionLink("添加用户组", "Add", "UserGroup") 用户组类型: @Html.DropDownList("GroupTypeList") </div> <table> <tr> <th> @Html.DisplayNameFor(model => model.Name) </th> <th> @Html.DisplayNameFor(model => model.Type) </th> <th> @Html.DisplayNameFor(model => model.Description) </th> <th></th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Name) </td> <td> @Html.DisplayFor(modelItem => item.Type) </td> <td> @Html.DisplayFor(modelItem => item.Description) </td> <td> @Html.ActionLink("修改", "Edit", new { id = item.UserGroupId }) | @Html.ActionLink("删除", "Delete", new { id = item.UserGroupId }) </td> </tr> } </table> </div> </div> <div></div> <script type="text/javascript"> $("#GroupTypeList").change(function () { window.location.href = "/UserGroup/List/" + $(this).children("option:selected").val(); }) </script>
完成,浏览器中查看一下