我在我的MVC 4项目中使用jQuery Unobtrusive Validation。验证效果很好,但SelectLists的错误消息显示在列表下方,而不是像文本框一样显示在右侧。知道为什么吗?两者都生成类.field-validation-error
这是我的剃刀html
选择列表:显示在
下面<div>
<div class="editor-label">
@Html.LabelFor(model => model.Process)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.Process, Model.ProcessList, "Select")
</div>
@Html.ValidationMessageFor(model => model.Process)
</div>
文本框
<div>
<div class="editor-label">
@Html.LabelFor(model => model.Design_By)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Design_By,new { @class = "disableInput" })
@Html.ValidationMessageFor(model => model.Design_By)
</div>
</div>
答案 0 :(得分:1)
尝试以下代码
<div>
<div class="editor-label">
@Html.LabelFor(model => model.Process)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.Process, Model.ProcessList, "Select")
@Html.ValidationMessageFor(model => model.Process)
</div>
</div>