title: ASP.NET MVC - Cascading Drop Down
body: <p>I'm currently learning ASP.NET MVC and using Nhibernate.</p>
  
  <p>I would like to use Cascading Drop-Down Boxes. Has anyone managed to get cascading drop-down boxes working in MVC?</p>
  
  <p>Updated:
  I have looked at the following website: <a href="http://stephenwalther.com/blog/archive/2008/09/07/asp-net-mvc-tip-41-creating-cascading-dropdown-lists-with-ajax.aspx" rel="noreferrer">link text</a> and used method 1.</p>
  
  <p>Controller Code</p>
  
  <pre><code>        var makeList = new SelectList(makeRepository.ListMakes (), "Id", "make",1);
          ViewData["Makes"] = makeList;
  
          //// Create Models view data
          var modelList = new CascadingSelectList(modelRepository.ListModels (Convert.ToInt32(makeList.SelectedValue.ToString())), "ModelID","Id", "Name");
          ViewData["Models"] = modelList;
  </code></pre>
  
  <p>View Code</p>
  
  <pre><code>&lt;%= Html.DropDownList("--Select Make--","Makes")%&gt;
  &lt;label for="Makes"&gt;Car Model:&lt;/label&gt;    
  &lt;%= Html.CascadingDropDownList("Models", "Makes") %&gt; 
  </code></pre>
  
  <p>The correct list of cars is listed when a Make with id of 1 is selected, but when I select a different make the model list is empty?</p>