title: How to get an object from a List<typeObject> in a DropDownlistFor?
body: <p>As a beginner in c#/asp.net/mvc, I can't find how to get an object from a Html.DropDownList in the View.
  Here is my ViewModel :</p>
  
  <pre><code>public class MyViewModel {
     public List&lt;Something&gt; ListOfSomething {get;set;} // A list of Somethings
     public Something TheSomethingToGet {get;set;} // The object I want to get
  }
  </code></pre>
  
  <p>The "Something" object is for example :</p>
  
  <pre><code>public class Something {
     public int Id {get;set;}
     public string Name {get;set;}
     public int AnotherProperty {get;set;}
  }
  </code></pre>
  
  <p>I populate my List&lt;> in the controller :</p>
  
  <pre><code>public ActionResult Index () {
     MyViewModel mvm=new MyViewModel();
     mvm.ListOfSomething=(my code to populate the List);
     return View(vm);
  }
  </code></pre>
  
  <p>The View is here :</p>
  
  <pre><code>@model Project.ViewModels.MyViewModel
  @Html.LabelFor(m =&gt; m.ListOfSomething)
  @Html.DropDownListFor(m =&gt; m.ListOfSomething, new SelectList(Model.ListOfSomething, "id", "name"), "-")&lt;br/&gt;
  </code></pre>
  
  <p>And eventually, the [HttpPost] Index of the controller :</p>
  
  <pre><code>[HttpPost]
  public ActionResult Index(MyViewModel mvm) {
      /* Here, how could I get the "Something" object that
         was selected in the dropdownlist and can be identified
         by the "id" property ?
      */
  
  }
  </code></pre>
  
  <p>I'm totally wrong ?
  Thanks</p>