tags:

views:

85

answers:

1

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)

A: 

Did you put a validation message placeholder?

<%= Html.ValidationMessageFor(model => model.CardDetail.SelectedCardSchemeId) %>

or:

<%= Html.ValidationSummary() %>
Darin Dimitrov
Thanks Darin, forget this. Oops!
Noel