Forums - C# Corner

Forum guidelines
Venkata Subbareddy

Venkata Subbareddy

  • 1k
  • 472
  • 22.8k

How to Implement The DataAnnotions in mvc for DropDown List

Nov 4 2015 6:21 AM
 Hi All ,
 
  This Is model 
  [Required(ErrorMessage = " Please Select The Country Name.")]
public string CountryName { get; set; }
 
This is view 
@Html.DropDownListFor(m => m.CountryId, new SelectList(Model.CountryList, "Id", "Name"), new { @class = "form-control", placeholder = "Select Country", @autofocus = "autofocus" }) 
 
 
 
i try apply DataAnnonations   dropdown list , but not working Where Iam Doing please give suggestions  

Answers (1)