title: How can I have one @Html.dropdownfor drive another in the MVC 3 View?
body: <ul>
  <li><p>I've got two types of data I'm dealing with:  "ClassType" and
  "Disciplines".  ClassType is the master data type that drives the
  secondary Disciplines.  The idea is that each ClassType will have a
  number of Disciplines assigned to them.  So, what I'm trying to do is
  have Disciplines depend on the selection of CLassType.  How would I
  do that with the Microsoft MVC 3 framework in the view?  The
  following is my Controller/Model/View code:</p>
  
  <pre><code>CONTROLLER:
  </code></pre>
  
  <p>public ActionResult Create()
      {
          List c_types = new List();
          List disc = new List();</p>
  
  <pre><code>    c_types = m_activeContract.getCtypeList();
      disc = m_activeContract.getDisciplineList();
      // TODO:  fetch from repository or database
  
      var model = new ExampleDocument
      {
          ClassTypes = a_modes,
          Disciplines = disc
      };
  
      return View(model);
  } 
  
  
  MODEL:
  
  public int ClassTypeId { get; set; }
  public int DisciplineId { get; set; }
  public List&lt;ClassType&gt; ClassTypes { get; set; }
  public List&lt;Discipline&gt; Disciplines { get; set; }
  
  VIEW:
  
  @using (Html.BeginForm("Create", "Example") ) {
          &lt;p&gt;Class Type: 
          @Html.DropDownListFor( x =&gt; x.ClassTypeId,
                   new SelectList(Model.ClassTypes, "Id", "Name"))&lt;/p&gt;
          &lt;p&gt;Discipline:
          @Html.DropDownListFor( x =&gt; x.DisciplineId,
                  new SelectList(Model.Disciplines, "Id", "Name")) &lt;/p&gt;
          &lt;p&gt;
              &lt;input type="submit" value="Create" /&gt;
          &lt;/p&gt;
  }
  </code></pre></li>
  </ul>