title: drop down list value is null after posting to controller in ASP.NET MVC
body: <p>I am new to ASP.NET MVC. I have a simple form with a submit button and an html select element, populated with two items. When the form posts to my controller, all the form values are null. I've even tried doing it with $.POST instead and the id variable I am sending is null when it gets to the controller. Here is my code: </p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code> @using (Html.BeginForm("SetOptionForUser", "MyController", FormMethod.Post, new { @class="form-inline" }))
  {
      @Html.AntiForgeryToken() 
      &lt;div class="text-center"&gt;
          &lt;div class="form-group"&gt;
              &lt;select id="ddlSelect" class="form-control"&gt;
                  @foreach (var item in Model.Persons)
                  {
                      &lt;option value="@item.Id"&gt;@item.Name&lt;/option&gt;
                  }
              &lt;/select&gt;
          &lt;/div&gt;
          &lt;button type="submit" class="btn btn-primary" id="btnEnter"&gt;Go&lt;/button&gt;
      &lt;/div&gt;
  }
  </code></pre>
  
  <p><strong>MVC Controller</strong></p>
  
  <pre><code>[ValidateAntiForgeryToken]
  [HttpPost]
  public ActionResult SetOptionForUser(FormCollection form)
      {
          string option = form["ddlSelect"].ToString(); //null error
          return RedirectToAction("AnotherAction", "AnotherController");
      }
  </code></pre>
  
  <p>It seems nothing in the form is being sent. I also tried this:</p>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$("#btnEnter").click(function (e) {
      var optionId = $("#ddlSelect").val(); //this get val correctly
      $.post(@Url.Action("SetOptionForUser", "MyController"), optionId);
    });
  </code></pre>
  
  <p><strong>MVC Controller for JS method</strong></p>
  
  <pre><code>**MVC Controller**
  
  [ValidateAntiForgeryToken]
  [HttpPost]
  public ActionResult SetOptionForUser(int optionId) //null
      {
          string option = optionId.ToString(); //null error
          return RedirectToAction("AnotherAction", "AnotherController");
      }
  </code></pre>
  
  <p>What I am doing wrong?</p>