Hi I am developing a web application in MVC 4 Asp.Net C#. I have a design which showing all the error at top of the page. But when using Data Annotations I am unable to show validation summary outside the form. Can any one please help me out to overcome this issue thans in advance. Following is my Senario
My forms look like this
@model ChrisFinnerty.Models.LocalPasswordModel
@{
ViewBag.Title = "Change Password";
}
@using (Html.BeginForm("ChangePassword", "Account", FormMethod.Post, new {@id = "FormChangePassword", @role = "form", @class = "form-horizontal well"}))
{
@Html.ValidationSummary()
<h2>Change Password</h2>
@Html.AntiForgeryToken()
@Html.PasswordFor(m => m.OldPassword, new {@class = "form-control"})
@Html.PasswordFor(m => m.NewPassword, new {@class = "form-control"})
@Html.PasswordFor(m => m.ConfirmPassword, new {@class = "form-control"})
<button type="submit" class="btn btn-default">Change Password</button>
<button type="button" class="btn btn-default" onclick="window.history.go(-1) ">Cancel</button>
}
But I want like that show validation summary outside the form in notification div
@model ChrisFinnerty.Models.LocalPasswordModel
@{
ViewBag.Title = "Change Password";
}
@Html.ValidationSummary() //*****Just want to add it here its not working****
@using (Html.BeginForm("ChangePassword", "Account", FormMethod.Post, new {@id = "FormChangePassword", @role = "form", @class = "form-horizontal well"}))
{
<h2>Change Password</h2>
@Html.AntiForgeryToken()
@Html.PasswordFor(m => m.OldPassword, new {@class = "form-control"})
@Html.PasswordFor(m => m.NewPassword, new {@class = "form-control"})
@Html.PasswordFor(m => m.ConfirmPassword, new {@class = "form-control"})
<button type="submit" class="btn btn-default">Change Password</button>
<button type="button" class="btn btn-default" onclick="window.history.go(-1) ">Cancel</button>
}