title: How to get the selected value from dropdownlist in Controller (MVC 2)
body: <p>I am struggling to get the selected value from the hard-coded dropdownlist in mvc , below is the code:</p>
  
  <p>View:</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;No of Helmets&lt;/td&gt;&lt;td&gt;&lt;div class="editor-field"&gt;
  
                  &lt;%: Html.DropDownList("helmets", (SelectList)ViewData["size"], "--select--")%&gt;
                  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  
                   &lt;tr&gt;&lt;td&gt;No of Garages&lt;/td&gt;&lt;td&gt;&lt;div class="editor-field"&gt;
                   &lt;%: Html.DropDownList("garages", (SelectList)ViewData["garages"], "--select--")%&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <p>// dropdown for helmets</p>
  
  <pre><code> [HttpPost]
      public ActionResult Create(Event trackday, FormCollection formValues)
      {Product product = new Product();//
          ViewBag.mode = "create";
  
          // for dropdown track
          ITrackRepository trackResp = new TrackRepository();
          IQueryable&lt;Object&gt; tracks = trackResp.GetVenuesSelectlist();
          ViewData["Venue"] = new SelectList(tracks, "VenueID", "Name");
         var helmets = Enumerable.Range(1, 200).Select(x =&gt; new SelectListItem { Value = x.ToString(), Text = x.ToString() });
          ViewData["helmets"] = new SelectList(helmets.ToList(), "Value", "Text");
  
          // dropdown for garages
          var garages = Enumerable.Range(1, 50).Select(x =&gt; new SelectListItem { Value = x.ToString(), Text = x.ToString() });
          ViewData["garages"] = new SelectList(garages.ToList(), "Value", "Text");  product.QtyAvailable = Convert.ToInt32(formValues["garages"]);
  
  
          if (ModelState.IsValid)
          {
              trackday.DateAdded = DateTime.Now;
              trackday.DateModified = DateTime.Now;
            //  productResp.Save();//
           //  trackday.Products.Add(product);
              trackdayResp.Add(trackday);
              trackday.Products.Add(product);
              trackdayResp.Save();
              return RedirectToAction("Index");
          }
          else
          {
              return View();
          }
  
  
      }`
  </code></pre>
  
  <p>How can I get the Selected value of the above 2 dropdownlist in mvc post controller.</p>