I am working on asp.net mvc-5 web application, and i have the following form:-

@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Contact</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "alert alert-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
            </div>
        </div>

now i want to be showing the @Html.ValidationSummary message at the top of the page outside the form tag .. but i am not sure if moving the @Html.ValidationSummary outside the form tag is a valid approach to follow ? or @Html.ValidationSummary need to be inside a form tag ?

Related posts

Recent Viewed