validate DropdownlistFor help
I couldn't get this code working. It's not displaying validation error message开发者_如何学编程 when I submit the form.
viewModel
[Required]
public SelectList CountryList { get; set; }
public string Country { get; set; }
Create.aspx
<%= Html.DropDownListFor(m => m.Country,Model.CountryList, "--Select--")%>
<%: Html.ValidationMessageFor(model => model.Country,"*") %>
Try this
public SelectList CountryList { get; set; }
[Required]
public string Country { get; set; }
精彩评论