title: ASP.NET MVC3 - problem handling multiple values from a strongly typed Listbox
body: <p>I'm having a problem handling multiple values from a strongly typed Listbox.
  I have an Event Class that can have multiple Technology classes.</p>
  
  <p>Here's my simplified Event class:</p>
  
  <pre><code>public class Event
  {
      public int ID { get; set; }
      public IEnumerable&lt;Technology&gt; Technologies { get; set; }
  }
  </code></pre>
  
  <p>I was using this</p>
  
  <pre><code>public List&lt;Technology&gt; Technologies { get; set; }
  </code></pre>
  
  <p>and changed to </p>
  
  <pre><code>public IEnumerable&lt;Technology&gt; Technologies { get; set; }
  </code></pre>
  
  <p>but still got the same error.</p>
  
  <p>Here's the Technology class, it's a really simple one</p>
  
  <pre><code>public class Technology
  {
      public int ID { get; set; }
      public String Description{ get; set; }
  }
  </code></pre>
  
  <p>here's my simplified Controller</p>
  
  <pre><code>public ActionResult Create()
      {
          var TechnologyQry = from d in db.Technology
                                orderby d.Description
                                select new { d.ID, d.Description };
          ViewBag.eventTechnology = new MultiSelectList(TechnologyQry ,"ID","Description");
          return View();
      }
  </code></pre>
  
  <p>and here's the view portion that renders the ListBox</p>
  
  <pre><code>@Html.ListBoxFor(model =&gt; model.Technologies, (MultiSelectList)ViewBag.eventTechnology)
  </code></pre>
  
  <p>and thit's the error I'm getting</p>
  
  <blockquote>
    <p>The ViewData item that has the key 'Technologies' is of type 'System.Collections.Generic.List`1[[stuff.Models.Technology, stuff, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' but must be of type 'IEnumerable'./</p>
  </blockquote>
  
  <p>Sorry, English is not my main language.
  I'd appreciate any help I can get.
  Thank you.</p>