title: DropDownListFor in Asp.Net MVC 4
body: <p>I have a sample application in Asp.Net MVC 4.  I don't find the way to obtain the selected id from the DropDownListFor helper and assign it as parameter to an ActionLink.</p>
  
  <p>Here is my models:</p>
  
  <pre><code>public class EmpresaLibroViewModel
  {
      //property a usar en vista Index ya que son iterables
      public IEnumerable&lt;EmpresaModel&gt; Empresas { get; set; }
      public IEnumerable&lt;BancoModel&gt; Bancos { get; set; }
      public IEnumerable&lt;LibroModel&gt; Libros { get; set; }
  
      //property que van a contener solo un registro (para Detalles, Editar)
      public EmpresaModel Empresa { get; set; }
      public BancoModel Banco { get; set; }
      public LibroModel Libro { get; set; }
  }
  </code></pre>
  
  <p>Here is the Edit method where I want to obtain the selected Banco ID and send as parameter to the ActionLink:</p>
  
  <pre><code>@model MvcApplication1.ViewModels.EmpresaLibroViewModel
  
  @{
      ViewBag.Title = "Edit";
  }
  
  &lt;h2&gt;Edit&lt;/h2&gt;
  
  @using (Html.BeginForm())
  {
  
  
     @Html.ValidationSummary(true)
  
  &lt;fieldset&gt;
      &lt;legend&gt;EmpresaModel&lt;/legend&gt;
  
      @Html.HiddenFor(model =&gt; model.Empresa.EmpresaModelID)
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Empresa.Nombre)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Empresa.Nombre)
          @Html.ValidationMessageFor(model =&gt; model.Empresa.Nombre)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.Empresa.Cuit)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(model =&gt; model.Empresa.Cuit)
          @Html.ValidationMessageFor(model =&gt; model.Empresa.Cuit)
      &lt;/div&gt;
  
      &lt;h3&gt;Tiene libros en:&lt;/h3&gt;
      &lt;table&gt;
              @foreach (var unitem in Model.Libros)
              {
              &lt;tr&gt;
                  &lt;td&gt;
                      @unitem.Bancos.Nombre (empresa:@unitem.EmpresaModelID - banco:@unitem.BancoModelID)
                      @Html.ActionLink("(eliminar)", "DesvincularBanco", new { id = unitem.LibroModelID, idEmp = unitem.EmpresaModelID })
                  &lt;/td&gt;
              &lt;/tr&gt;
              }
      &lt;/table&gt;
      &lt;h3&gt;Agregar:&lt;/h3&gt;
      @Html.DropDownListFor( model =&gt; model.Banco.BancoModelID , new SelectList(Model.Bancos, "BancoModelID", "Nombre")))
      @Html.ActionLink("(agregarlo)", "VincularBanco", new { idempresa=Model.Empresa.EmpresaModelID , idbanco=10 }  )
  
      &lt;p&gt;
          &lt;input type="submit" value="Save" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p>What is the best way to do it?
  Thanks.</p>
  
  <p>Note: the idBanco=10 has set to verify that working the ActionLink. I know that that value must be from the DropDownListfor.</p>