MVC 4在表单外显示验证摘要?

Waq*_*ees 5 c# asp.net-mvc asp.net-mvc-4

嗨,我正在开发MVC 4 Asp.Net C#中的Web应用程序.我有一个设计,显示页面顶部的所有错误.但是在使用数据注释时,我无法在表单外显示验证摘要.任何人都可以帮我解决这个问题.以下是我的Senario

我的表格看起来像这样

    @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>
     }
Run Code Online (Sandbox Code Playgroud)

但我想在通知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>
         }
Run Code Online (Sandbox Code Playgroud)

Aja*_*jay -1

只需@Html.ValidationSummary()在表格旁边添加即可。我有同样的问题看到这个。MVC3 验证摘要控制

请参阅此示例http://mahaafifi.blogspot.in/2011/12/multiple-validation-summary-at-single.html