Code is given below:
If i do not select any value in the combobox and press submit, no validation message is asked.
<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>
Solved after a lot of research...
$(document).ready(function () {
var validator = $("#Your_form_id").data('validator');
validator.settings.ignore = ":hidden:not(select)";
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With