How to client side validate the dropdownlist box…..
@Html.DropDownListFor(per => per.Gender, new[] {
new SelectListItem(){Text = "Male" , Value="Male"},
new SelectListItem(){Text ="Female" , Value = "Female"},
}, "Select Your Gender")
@Html.ValidationMessageFor(per => per.Gender)
Include jquery validate plugin scripts in your view along with jQuery (if not already refered in the Layout.cshtml)
And make sure the SomeModel’s Gender property is required
Update your
web.configto and set the AppSetting calledClientValidationEnabledto trueNow when you submit, it will execute the client side validation, if javascript is enabled in the browser.