title: Updating a Partial View in MVC 5
body: <p>I am getting an error when trying to load a partial view that should display a list on the create view of the MVC app. The list is based on a value will come from a list of values drop control. </p>
  
  <p>On create view there is no selection so the list is empty and will need to refreshed after the user selects a value while in the MVC create view.</p>
  
  <p>I followed the accepted answer on this question and got errors:</p>
  
  <p><a href="https://stackoverflow.com/questions/18254749/updating-partialview-mvc-4">Updating PartialView mvc 4</a></p>
  
  <p>But I have some questions about what is being said.</p>
  
  <p>Someone said: "There are some ways to do it. For example you may use jQuery:" and he shows the Java query.</p>
  
  <p>But he also shows another method and says: "If you use logic in your action UpdatePoints() to update points"</p>
  
  <pre><code>[HttpPost]
  public ActionResult UpdatePoints()
  {    
     ViewBag.points =  _Repository.Points;
     return PartialView("UpdatePoints");
   }
  </code></pre>
  
  <p>I get the following error </p>
  
  <blockquote>
    <p>The parameters dictionary contains a null entry for parameter 'ID' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult UpdateList(Int32)' in 'System.Controllers.RController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters</p>
  </blockquote>
  
  <p>I have no clue what this error means</p>
  
  <p>So in create view:</p>
  
  <pre><code>        &lt;div class="col-sm-6"&gt;
  
              &lt;div class="form-horizontal" style="display:none" id="PVList"&gt;
  
                  @{ Html.RenderAction("UpdateList");}
  
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p>In controller under the create action as its own function</p>
  
  <pre><code>    [HttpGet]
      public ActionResult UpdateList(int ID)
      {
  
          if (ID != 0)
          {
              ViewBag.List = Get_List(ID);
              return PartialView("PV_List");
  
          }
          else
          {
              ViewBag.List = "";
              return PartialView("");
          }
  
  
      }
  </code></pre>
  
  <p>And the function that makes the list for the view bag function:</p>
  
  <pre><code>private List&lt;SQL_VIEW_LIST&gt; Get_List(int ID)
          {
  
              return db.SQL_VIEW_LIST.Where(i =&gt; i.ID == ID).ToList();
          }
  </code></pre>
  
  <p>The JavaScript for the for the list of values drop down list of values: That also controls turning on the visibility of the list when it has data: </p>
  
  <pre><code>    //Fire The List to make visible after list values select 
      $(document).ready(function () {
          $('#RES_VEH_ID').change(function ()
          {
  
              $("#PV_List").show(); // Shows Edit Message
              $.post('@Url.Action("PostActionTo_Partial","Create")').always(function()
                     { ('.target').load('/Create'); })
  
          });
      })
  </code></pre>
  
  <p>Also does anyone know what this string mean: ? "PostActionTo_Partial"</p>
  
  <p>Also does anyone know what this means ViewBag.points =  _Repository.Points; I get the view bag part but it's the  _Repository.Points; part that I don't understand. Any one have any ideas of what is going on there?</p>