@functions{
    //获取子级数据
    private string GetChildColumn(IEnumerable<dynamic> columnDataList, string urlPrefix, int parentId)
    {
        string rv = "";
        if (parentId == 0)
        {
            return "";
        }
        IEnumerable<dynamic> data = columnDataList.Where(c => c.ParentId == parentId && c.Show == 1).OrderBy(c => c.Xuhao);
        foreach (var item in data)
        {
            string url = urlPrefix + item.Path;
            string target = item.Target;
            rv += "<li data-id=\"" + item.Id + "\"><a href=\"" + url + "\" target=\"" + target + "\">" + item.Name + "</a>" + GetChildColumn(columnDataList, urlPrefix, item.Id) + "</li>";
        }
        if (rv != "")
        {
            rv = "<ul>" + rv + "</ul>";
        }
        return rv;
    }
}
@{
    int columnId = (int)ViewBag.ColumnId;//当前栏目id
    int siteId = (int)ViewBag.SiteId;//当前站点id
    string urlPrefix = (string)ViewBag.SiteUrlPrefix;//当前站点Url前缀
    IEnumerable<dynamic> ColumnList = Html.GetColumnList(c => c.SiteId == siteId);
    dynamic topParentData = Html.GetTopParentData(ColumnList, columnId);
    int parentId = columnId;
    if (topParentData == null)
    {
        topParentData = ColumnList.Where(c => c.Id == columnId).First();
    }
    else
    {
        parentId = topParentData.Id;
    }
    string navList = GetChildColumn(ColumnList, urlPrefix, parentId);
    if (navList=="")
    {
        navList = "<ul><li data-id=\"" + topParentData.Id + "\"><a href=\"" + Html.ColumnUrl((int)topParentData.Id) + "\" target=\"" + topParentData.Target + "\">" + topParentData.Name + "</a></li></ul>";
    }
}
<div class="nav_box nav_box_menu">
    <div class="nav_title">
        <span class="nav_sign">@(topParentData.Name)</span>
        <span class="nav_more"></span>
    </div>
    <div class="nav_menu">
        @Html.Raw(navList)
    </div>
</div>
<script>
    $(".nav_box").NavDropDown({ triggerEvent: "click" });
    $(function () {
        var currentFirstColumn = $(".nav_box").find("li[data-id='@columnId']");
        if (currentFirstColumn.length > 0) {
            currentFirstColumn.addClass("nav_current");
            currentFirstColumn.parents("li").addClass("nav_current");
        }
    })
</script>
