title: How to use ViewBag to pass list of data from View to controller
body: <p>how can i sen a list of items from a view to a controller to save it. i believe that i can use Viewbag  but i dont realy no how to use ite to pass data from view to controller. </p>
  
  <p>this is what i have tried
  My view </p>
  
  <pre><code>@using (Html.BeginForm()) {
  @Html.ValidationSummary(true)
  &lt;fieldset&gt;
      &lt;legend&gt;ProductionOrderItem&lt;/legend&gt;
  
  
      &lt;div class="editor-label"&gt;
          @Html.Label("ProducrionOrderNo");
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBox("ProductionOrderNo", ViewBag.ProductionOrder as int)
  
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
         @Html.Label("OrderName")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBox("OrderName", ViewBag.ProductionOrder as string)
      &lt;/div&gt;
   &lt;div class="editor-label"&gt;
         @Html.Label("OrderDate")
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.TextBox("OrderDate", ViewBag.ProductionOrder as DateTime)
  &lt;/div&gt;
        &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p>and my controller</p>
  
  <pre><code>   [HttpPost]
       public ActionResult Create(FormCollection collection)
       {
          ProductionRegistration pr = new ProductionRegistration();
          ProductionItem poi = new ProductionItem();
  
           poi = Viewbag.ProductionOrder;
  
           pr.SaveOrder(Conn, poi);
           return RedirectToAction("Index");
  
       }
  </code></pre>