@{
    string templateDirectory = ViewBag.TemplateDirectory;
    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.Show == 1 && c.SiteId == siteId);
    dynamic topParentData = Html.GetTopParentData(ColumnList, columnId);//获取当前栏目的父级ids
    int parentId = columnId;
    if (topParentData != null)
    {
        parentId = topParentData.Id;
    }
}
<div class="top_box">
    <div class="w1200">
        <a class="logo" href="/">
            <img src="@templateDirectory/image/logo.png" border="0">
        </a>
        <div class="menu_box">
            <ul>
                @{
                    IEnumerable<dynamic> ColumnList1 = ColumnList.Where(c => c.Level == 1).OrderBy(c => c.Xuhao);
                    foreach (var item in ColumnList1)
                    {
                        int id = item.Id;
                        <li class="menu_style" data-id="@item.Id">
                            <a class="menu" href="@Html.ColumnUrl(id)" target="@item.Target"> @item.Name</a>
                            @{
                                ViewDataDictionary menuDictionary = new ViewDataDictionary();
                                menuDictionary.Add("parentId", item.Id);
                                menuDictionary.Add("level", 1);
                            }
                            @Html.Partial("MenuListModel", ColumnList, menuDictionary)
                        </li>
                    }
                }
            </ul>
        </div>
    </div>
</div>
<script>
    $(".menu_box").NavDropDown({ triggerEvent: "mouse" });
    $(function () {
        var currentFirstColumn = $(".menu_box").find("li[data-id='@parentId']");
        if (currentFirstColumn.length > 0) {
            currentFirstColumn.addClass("current")
        }
    })
</script>
