代码如下:
如果我没有在组合框中选择任何值并按提交,则不会询问验证消息.
如果我没有在组合框中选择任何值并按提交,则不会询问验证消息.
<tr> <td>Department </td> <td> : </td> <td class="@*@Model.NoEdit*@"> @Html.DropDownListFor(m => m.DepartmentId,new SelectList(Model.Departments,"SelectedDepartmentId","DepartmentCode"),"-- Select Department--",new {@class = "chosen-select",id = "cboDeptartment" }) @Html.ValidationMessageFor(model => model.DepartmentId) </td>
解决方法
重申我的简短评论作为答案. 原文链接:https://www.f2er.com/html5/168838.html