在我的 MVC 4 项目中,我在我的_Layout.chshtml
页面中呈现了一个局部视图。它在下拉菜单中:
<div class="dropdown-menu" id="dropdown-login>
@Html.Partial("~/Views/Account/_LoginPartial.cshtml")
</div>
当我运行我的应用程序并单击下拉菜单时,会发生这种情况:
我有其他局部渲染,这种事情不会发生。有人知道为什么会这样吗?
局部视图
@model LetLord.Models.LoginModel
@(Html.BeginForm("Login", "Account", FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.LabelFor(m => m.UserName)
@Html.TextBoxFor(m => m.UserName)
@Html.ValidationMessageFor(m => m.UserName)
@Html.LabelFor(m => m.Password)
@Html.PasswordFor(m => m.Password)
@Html.ValidationMessageFor(m => m.Password)
@*@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })*@
<input type="submit" value="Log in" class="btn btn-primary btn-block" />
<p>
@Html.ActionLink("Register", "Register", "Account", routeValues: null,
htmlAttributes: new { id = "registerLink" }) if you don't have an account. </p>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}