When I use
@{Html.RenderPartial("Login");}
inside my main view, the @Html.ValidationSummary() doesn't work, but when I copy the code from "Login" inside main view, it works.
Why is that, and how do I display validation messages from the partial view?
Here is partial view "Login":
@model NyNo.Models.LoginModel
@using (Html.BeginForm())
{
<fieldset>
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
@Html.TextBoxFor(m => m.UserName, new { @placeholder = "Username" })
@Html.ValidationMessageFor(m => m.UserName)
@Html.PasswordFor(m => m.Password, new { @placeholder = "Password" })
@Html.ValidationMessageFor(m => m.Password)
@Html.CheckBoxFor(m => m.RememberMe)
@Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" })
<input type="submit" class="button" value="Log in" />
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
Hope you understand, thanks!