title: ASP.NET MVC fails to bind and validate DropDownListFor if Range is set and Javascript disabled
body: <p>I have the following property in my model:</p>
  
  <pre><code>    [Required]
      [Range(1, int.MaxValue, ErrorMessage = "Bad number")]
      public virtual int Number { get; set; }
  </code></pre>
  
  <p>I am filling it in Controller:</p>
  
  <pre><code>List&lt;SelectListItem&gt; items = new List&lt;SelectListItem&gt;();
  // numbers is just a list with entities with an integer field Number
  items.AddRange(numbers.
                  Select(n =&gt; new SelectListItem() { Text = n.Number.ToString(), Value = n.Number.ToString() })
                  .ToArray());
  
  ViewBag.Numbers = items;
  </code></pre>
  
  <p>And in my view I have the following:</p>
  
  <pre><code>            @Html.DropDownListFor(m =&gt; m.Number, ViewBag.Numbers as IEnumerable&lt;SelectListItem&gt;, "Select a number")
              @Html.ValidationMessageFor(m =&gt; m.Number)
  </code></pre>
  
  <p>It seems to work fine, if Javascript is enabled - when I select the first item (which is empty "Select a number"), Required validator kicks in and does not allow POSTing.</p>
  
  <p>But when I disable Javascript, then I get an exception in my view right on that DropDownListFor method call:</p>
  
  <pre><code>The ViewData item that has the key 'Number' is of type 'System.Int32' but must be of type 'IEnumerable&lt;SelectListItem&gt;'. 
  </code></pre>
  
  <p>When I comment out the [Range], then there is no such exception, but then it seems Required does not work - I can POST the empty "Select a number" option (which has value="") and my model passes validation, but it should not - empty string is not a valid integer! Why does it work fine with Javascript enabled, but fails server-side?</p>