我有一个带有菜单的部分视图,具体取决于我要显示或隐藏链接的当前操作,我的尝试如下
@if (ViewContext.Controller.ValueProvider.GetValue("action").RawValue.ToString() == "Users")
{
<script>
$("#addVS").show();
</script>
}
<li>@Html.ActionLink("Users", "Users", "Users")
<ul id="addVS" style="display:none;">
<li>@Html.ActionLink("Add New User", "AddEditRecord", "Users",new { mode = "null"}, new { @id = "openDialog" })</li>
</ul>
</li>