title: MVC Multiple DropDownLists on one page?
body: <p>I'm new to MVC and I am trying to bind multiple dropdownlists on the same page, so I can grab the selected value from each and use it to search the database.  My code gives me an infinite loop.  Can anyone tell me what I'm doing wrong, or recommend a better way to achieve this?</p>
  
  <p><strong>Model</strong>:</p>
  
  <pre><code>public class SelectViewModel
      {
  
          public SelectList MakeList { get; set; }
          public SelectList ColorList { get; set; }
      }
  </code></pre>
  
  <p><strong>Controller</strong>:</p>
  
  <pre><code>  public ActionResult Index()
          {
              SelectViewModel objSelectModel = new SelectViewModel();
              List&lt;Make&gt; objMake = new List&lt;Make&gt;();
              List&lt;Color&gt; objColor = new List&lt;Color&gt;();
  
              objMake = GetMakeList();
              SelectList objBindMake = new SelectList(objMake, "MakeID", "Make1", 0);
  
              objColor = GetColorList();
              SelectList objBindColor = new SelectList(objColor, "ColorID", "Color1", 0);
  
              objSelectModel.MakeList = objBindMake;
              objSelectModel.ColorList = objBindColor;
  
              return View(objSelectModel);
          }
  
  
  
          public List&lt;Make&gt; GetMakeList()
          {
              var query = from m in makeRepository.Makes
                          select m;
              var makes = query.ToList();
              return makes;
          }
  
          public List&lt;Color&gt; GetColorList()
          {
              var query = from c in colorRepository.Colors
                          select c;
              var colors = query.ToList();
              return colors;
          }
  </code></pre>
  
  <p><strong>View</strong>:</p>
  
  <pre><code>@model MvcApplication1.WebUI.Models.SelectViewModel
    Make : @Html.DropDownList("Make", new SelectList(Model.MakeList, "Value", "Text", Model.MakeList.SelectedValue))
  
    Color: @Html.DropDownList("Color", new SelectList(Model.ColorList, "Value", "Text", Model.ColorList.SelectedValue))
  </code></pre>