title: Error when trying to cascade pulldowns using jQuery JSON MVC
body: <p>Exception Details: System.ArgumentNullException: Value cannot be null.
  Parameter name: items
  this is the pulldown helper that triggers the error:</p>
  
  <pre><code>  @Html.DropDownListFor(model =&gt; model.OrigSampID, new SelectList(Model.OrigSampID,"OrigSampID","SampDate"))
  </code></pre>
  
  <p>this is the .change call that is supposed to make a Json call to fill the pulldown:</p>
  
  <pre><code>//Hook onto the SampType list's onchange event  
  $("#SampType").change(function() {   
  
      $.getJSON('Home/GetOriginalIDs', {thisPWS: $("#PWS").val() }, function (data) {  
        //Clear the Model list    
        $("#OrigSampID").empty();    
        //Foreach Model in the list, add a model option from the data returned    
        $.each(data, function(index, optionData) {       
           $("OrigSampID").append("&lt;option value=" + optionData.OrigSampID + "&gt;" + optionData.SampDate + "&lt;/option&gt;");    
        });
     });  
  }).change();
  </code></pre>
  
  <p>This is the function called in the controller:</p>
  
  <pre><code>public JsonResult GetOriginalIDs(string thisPWS)
  {
  
      JsonResult result = new JsonResult();
  
      var positives = (from c in _db.DWS_BactiBucket.OrderByDescending(x =&gt; x.SampDate)
                 where c.PWS == thisPWS &amp;&amp; c.SampType == "R" &amp;&amp; c.IsTOTPresent == "1"
                 select c).Take(6);
  
      result.Data = positives.ToList();
      result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
      return result;
  
  
  }
  </code></pre>
  
  <p>I have tried for the last 7 hours to get a 2nd pulldown filled with data depending on what it was sent. MVC is not a tool, it's an IQ test and I am a dummy.
  It would be nice to return anything from the JSON call.</p>
  
  <p>Edit:
  Here is the block of code in the HomeController that works to fill a pulldown at Form load time, which is not what I want, but shows the query and hooking to a pulldown works. I just can't get it to work for jQuery Ajax or Json</p>
  
  <pre><code>    //private List&lt;SelectListItem&gt; GetXX(string thisPWS)
      //{
      //    List&lt;SelectListItem&gt; list = new List&lt;SelectListItem&gt;();
  
      //    var cat = (from c in _db.DWS_BactiBucket.OrderByDescending(x =&gt; x.SampDate) 
      //               where  c.PWS == thisPWS &amp;&amp; c.SampType  == "R" &amp;&amp; c.IsTOTPresent  == "1" select c).Take(6).ToArray();
  
      //    for (int i = 0; i &lt; cat.Length; i++)
      //    {
      //        list.Add(new SelectListItem { Text = cat[i].LabSampID + " (" + cat[i].SampDate + ")", Value = cat[i].LabSampID.ToString() });
      //    }
  
      //    return list;
      //}
  </code></pre>
  
  <p>And here is the pulldown built to work and get loaded on form load:</p>
  
  <pre><code> @Html.DropDownListFor(model =&gt; model.OrigSampID, (IEnumerable&lt;SelectListItem&gt;)ViewBag.Originals)
  </code></pre>