0
我在asp.net的MVC-5 Web应用程序的工作外,我有以下形式: -没有任何problemif我把Html.ValidationSummary()形式的标签
@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>
现在我想在页面顶部显示@Html.ValidationSummary
消息在窗体标记之外..但我不确定是否将@Html.ValidationSummary
移动到窗体标记之外是一种有效的方法?或@Html.ValidationSummary
需要在表单标签内?
感谢您的澄清 –
这似乎并不是我使用MVC4的情况.. – eaglei22
可以确认这是在MVC 5中的情况 –