title: MVC4 - how to vaildate a drop down list?
body: <p>I have a .Net MVC4 model / view with a number of [Required] fields, one of which is selected via a drop down list, "Content_CreatedBy" [the first code block below].</p>
  
  <p>Client side validation fires on all fields except the DDL [although server side validation does not allow no entry in DDL]. I have tried validating on the DDL text as well its numeric value but niether fire on the client side.</p>
  
  <p>Can anyone see what I am doing wrong?</p>
  
  <p>Thanks<br>
  <strong>Model</strong></p>
  
  <pre><code>[Required]
  [Display(Name = "Author")]
  [ForeignKey("ContentContrib")]
  [Range(1, 99, ErrorMessage = "Author field is required.")]
  public virtual int Content_CreatedBy { get; set; }
  
  [Required]
  [Display(Name = "Date")]
  public virtual DateTime Content_CreatedDate { get; set; }
  
  [Required]
  [DataType(DataType.MultilineText)]
  [Display(Name = "Source / Notes ")]
  [StringLength(10, MinimumLength = 3)]
  public virtual string Content_Sources { get; set; }
  
  [Required]
  [Display(Name = "Keywords")]
  [StringLength(50, MinimumLength = 3)]
  public virtual string Content_KeyWords { get; set; }
  </code></pre>
  
  <p><strong>VIEW</strong></p>
  
  <pre><code>&lt;div class="editor-label"&gt;
  @Html.LabelFor(model =&gt; model.Content_CreatedBy, new { @class="whitelabel"})
  &lt;/div&gt;
  
  &lt;div class="editor-field"&gt;
  
  @Html.DropDownList("Content_CreatedBy", String.Empty)
  @Html.EditorFor(model =&gt; model.Content_CreatedBy)
  @Html.ValidationMessageFor(model =&gt; model.Content_CreatedBy)
  &lt;/div&gt;
  </code></pre>