title: Populate DropDownList in ASP.NET MVC
body: <p>So basically I'm trying to make a website that can do stuff like the programs in the super markets
  database with products / Views where sellers work , Views to add new products and receipt note model.So I have a class </p>
  
  <pre><code>public class Product
  {
      public int ID { get; set; }
      public string Title { get; set; }
      public int Quantity { get; set; }
      public decimal Price { get; set; }
  }
  
  public class ProduktiDBContext : DbContext
  {
      public DbSet&lt;Product&gt; Products { get; set; }
  }
  </code></pre>
  
  <p>and a controller </p>
  
  <pre><code>public class ProduktiController : Controller
  {
      private ProduktiDBContext db = new ProduktiDBContext();
  
      public ActionResult Index()
      {
          return View(db.Products.ToList());
      }
  
      public ActionResult Create()
      {
          return View();
      }
  
      [HttpPost]
      public ActionResult Create(Product product)
      {
          if (ModelState.IsValid)
          {
              db.Products.Add(product);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          return View(product);
      }
  }
  </code></pre>
  
  <p>and in the Index View I want to add a DropDownList with all the titles of the products from the database</p>
  
  <pre><code>@model IEnumerable&lt;Produkti.Models.Product&gt;
  
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Title)
          &lt;/th&gt;
  
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Quantity)
          &lt;/th&gt;
  
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Price)
          &lt;/th&gt;
  
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Title)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Quantity)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Price)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
              @Html.ActionLink("Details", "Details", new { id=item.ID }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.ID })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  
  &lt;hr /&gt;
      @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              //I'd like to put the dropdownlist here i dont know if this for loop is necessary
          &lt;/td&gt;
         &lt;td&gt;
  
         &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  </code></pre>
  
  <p>I was wondering if I need to pass a List with all the titles from the controller to the View or the <code>return View(db.Products.ToList());</code> from the Index Method already pass the data that I need, and how to pass data from this DropDownList</p>