title: Having an issue with "DataReader already open"
body: <p>I've searched on SO and didn't find any answer to the problem I'm having.</p>
  
  <p>I made a linq to get all data from two tables and one ajax call to get new data and fill my dropdownlist as the other dropdownlist changes.</p>
  
  <p>Here's what I have so far: </p>
  
  <h2>Controller</h2>
  
  <pre><code>public ActionResult Index(int? page)
  {
      vEntities db = new vEntities();
  
      var estados = (from e in db.estado
                     select e);
  
      var localidades = (from l in db.localidade
                         select l);
  
      ViewData["estados"] = new SelectList(estados, "cod", "descricao");
      ViewData["localidades"] = new SelectList(localidades, "id", "descricao");
  
      return View();
  }
  
  public ActionResult GetLocalidades(string codEstado)
  {
      vEntities db = new vEntities();
  
      var info = (from l in db.localidade
                  where l.cod_estado == codEstado
                  select l);
  
      return Json(info);
  }
  </code></pre>
  
  <h2>View</h2>
  
  <pre><code>&lt;%= Html.DropDownList("estados", ViewData["estados"] as SelectList, String.Empty)%&gt;
  &lt;%= Html.DropDownList("localidade", ViewData["localidades"] as SelectList, String.Empty)%&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $("#estados").change(function () {
              var ddlLocalidade = $("#localidade")[0];
              ddlLocalidade.length = 0;
              var cod = $(this).val();
  
              $.post(
                  "/Home/GetLocalidades",
                  { codEstado: cod },
                  function (data) {
                      var option;
                      $.each(data, function () {
                          option = new Option(this.descricao, this.id);
                          ddlLocalidade.options.add(option);
                      });
                  }
                  );
  
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And when I change the first dropdown, which activates the JS function, I'm getting this error right after the method "Getocalidades" returns the Json: </p>
  
  <blockquote>
    <p>There is already an open DataReader
    associated with this Connection which
    must be closed first</p>
  </blockquote>
  
  <p>I guess I'm having some trouble formatting the code :) sorry for that.</p>
  
  <p>I can't see any problem with the connection, can anyone tell me what's wrong, please ?</p>
  
  <p>Thanks in advance</p>