title: How do I post a select list value with ASP.NET MVC DropDownListFor()?
body: <p>I'm having an issue using the <code>DropDownListFor()</code> function with ASP.NET MVC:</p>
  <p>Model:</p>
  <pre><code>public class ShoeSizeModel
  {
      public List&lt;ShoeModel&gt; ShoeListModel { get; set; }
      public List&lt;SizeModel&gt; Sizes { get; set; }
      public int SelectedSizeId { get; set; }
  
      public IEnumerable&lt;SelectListItem&gt; SizesSelectList
      {
          get
          {
              return new SelectList(Sizes, &quot;SizeId&quot;, &quot;Size&quot;);
          }
      }
  </code></pre>
  <p>View:</p>
  <pre><code>    @model Models.ShoeSizeModel
  
  &lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;Shoe Selection&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;../../Scripts/css/base.css&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;../../Scripts/css/gallery.css&quot;&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      @Html.AntiForgeryToken()
  
      @using (Html.BeginForm(&quot;FilterBySize&quot;, &quot;Shoe&quot;, FormMethod.Post))
      {
          &lt;div class=&quot;refiners&quot;&gt;
              @Html.DropDownListFor(
                       model =&gt; model.SelectedSizeId,
                       Model.SizesSelectList,
                       &quot;Size&quot;,
                       new { onchange = &quot;this.form.submit();&quot; })
          &lt;/div&gt;
      }
      ...
  </code></pre>
  <p>Controller:</p>
  <pre><code>[HttpPost]
  public ActionResult FilterBySize(int sizeId)
  {
      return View();
  }
  </code></pre>
  <p>If I try to pass the SizeId from the SelectList to the FilterBySize method, I get a null value:</p>
  <p><a href="https://i.stack.imgur.com/17bgV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/17bgV.png" alt="enter image description here" /></a></p>
  <p>Interestingly, if I try to pass it as a model instead, the select list value passes just fine:</p>
  <p><a href="https://i.stack.imgur.com/BkrwZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BkrwZ.png" alt="
  " /></a></p>
  <p>I'm probably just missing something obvious here, and it's not the end of the world if I just have to pass the model and take the value from there, but I'd rather just pass the value if I can. Please can someone explain to me what I'm doing wrong?</p>