MVC 动态菜单

直接上代码:

一,创建菜单

Action

public ActionResult GetMenu()
{
//获取菜单
List<MenuItem> mainMenu = mm.GetMenuByUser(CurrentUser); return PartialView("~/Views/MainPage/GetMenu.cshtml", mainMenu);
}

View

@model List<BLL.Models.Entitys.MenuItem>

<ul >

    @foreach (var item in Model)
{
//target指向 iframe name
<li><a href="item.菜单路径" target="myFrameName">@item.菜单名称</a></li> }
</ul>

二,创建主页面,引用菜单action

<div class="main" id="menu">
@Html.Action("GetMenu") <iframe id="myFrameName" name="myFrameName" frameborder="0" scrolling="auto" width="100%" ></iframe> </div>
上一篇:LDAP-常用命令


下一篇:【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8