title: Listbox control in MVC with Entity Framework
body: <p>I am very new in Entity Framework here and try to create a simple listbox control but the listbox comes out empty. Please help and tell me what I did wrong here.</p>
  
  <p>DAL (Entity Framework):</p>
  
  <pre><code>namespace DataAccess
  {
  using System;
  using System.Collections.Generic;
  
  public partial class Client
  {
      public Client()
      {
          this.AnotoPGCFiles = new HashSet&lt;AnotoPGCFile&gt;();
          this.Client1 = new HashSet&lt;Client&gt;();
          this.Client11 = new HashSet&lt;Client&gt;();
          this.ClientBillingSetups = new HashSet&lt;ClientBillingSetup&gt;();
          this.ClientDataStores = new HashSet&lt;ClientDataStore&gt;();
          this.ClientDepartments = new HashSet&lt;ClientDepartment&gt;();
          this.ClientFileNames = new HashSet&lt;ClientFileName&gt;();
          this.ClientReports = new HashSet&lt;ClientReport&gt;();
      }
  
      public int ID { get; set; }
      public string Name { get; set; }
      public string ContactName { get; set; }
      public string ContactEmail { get; set; }
      public string PathToLogo { get; set; }
      public bool Disabled { get; set; }
      public System.DateTime Created { get; set; }
      public int TimeZoneID { get; set; }
  
      public virtual AnotoLicensePool AnotoLicensePool { get; set; }
      public virtual ICollection&lt;AnotoPGCFile&gt; AnotoPGCFiles { get; set; }
      public virtual ICollection&lt;Client&gt; Client1 { get; set; }
      public virtual Client Client2 { get; set; }
      public virtual ExternalSystemDemographicConfiguration  ExternalSystemDemographicConfiguration { get; set; }
      public virtual ICollection&lt;Client&gt; Client11 { get; set; }
      public virtual Client Client3 { get; set; }
      public virtual TimeZone TimeZone { get; set; }        
   }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public ActionResult Index()
   {
    ViewData["ReportFormat"] = "html";
    ViewBag.Title = "Home Page";
  
    var db = new DataAccess.Client();
    IEnumerable&lt;SelectListItem&gt; clients = db.Client1
          .Select(c =&gt; new SelectListItem
          {
                Value = c.ID.ToString(),
                Text = c.Name
          });
  
    ViewBag.Clients = clients;
    return View();
   }
  </code></pre>
  
  <p>View: </p>
  
  <pre><code>@Html.ListBox("ListClients", (IEnumerable&lt;SelectListItem&gt;) ViewBag.Clients)
  </code></pre>