Validation on DropDownListFor not working with DataAnnotations
- by Noel
If I have a drop down list as follows
<div class="editor-label">
<%= Html.DropDownListFor(model => model.CardDetail.SelectedCardSchemeId,
Model.CardDetail.CardSchemes, "Select")%>
</div>
and in my model I am using DataAnnotations
[Required(ErrorMessage = "* Required SelectedCardSchemeId Message")]
public int SelectedCardSchemeId { get; set; }
How can I get the message to appear in the view?
In debug I can see the ModelState error is populated, but the message is not displayed on the view.
I do not have issues with displaying error message for other controls (TextBoxFor)