title: How to show the data inside of a dropboxlist inside, using static method in the code behind to fill the dropdownlist
body: <p>the idea is to fill the dropdownlist, with information from the database, the code was debugged and the information if stored in the dropdownlist, the problem is that it, you can not see any advice.</p>
  <p>I will not use the update panel.</p>
  <p>The javascript function is calling the method in the code behind, the only problem is that I don't see the information</p>
  <pre><code> &lt;asp:UpdatePanel ID=&quot;UpdatePanel1&quot; runat=&quot;server&quot;&gt;
        &lt;ContentTemplate&gt;
          &lt;div class=&quot;grid3&quot;&gt;
          &lt;asp:Label runat=&quot;server&quot; Text=&quot;Provincia&quot;&gt;&lt;/asp:Label&gt;
         &lt;asp:DropDownList ID=&quot;droplistProvincia&quot; ClientIDMode=&quot;Static&quot;  AutoPostBack=&quot;false&quot;  OnSelectedIndexChanged=&quot;droplistProvincia_SelectedIndexChanged&quot; onclick=&quot;&quot; Width=&quot;100%&quot; runat=&quot;server&quot; Height=&quot;30px&quot;&gt;
          &lt;asp:ListItem Text=&quot;Seleccione&quot;&gt;&lt;/asp:ListItem&gt;
          &lt;/asp:DropDownList&gt;
         &lt;asp:Label runat=&quot;server&quot; Text=&quot;Cantón&quot;&gt;&lt;/asp:Label&gt;
         &lt;asp:DropDownList ID=&quot;droplistCanton&quot; CssClass=&quot;item15&quot;  AutoPostBack=&quot;true&quot; OnSelectedIndexChanged=&quot;droplistCanton_SelectedIndexChanged&quot; Width=&quot;100%&quot; runat=&quot;server&quot; Height=&quot;30px&quot;&gt;
         &lt;asp:ListItem Text=&quot;Seleccione&quot;&gt;&lt;/asp:ListItem&gt;
         &lt;/asp:DropDownList&gt;
         &lt;asp:Label runat=&quot;server&quot; CssClass=&quot;item16&quot; Text=&quot;Distrito&quot;&gt;&lt;/asp:Label&gt;
         &lt;asp:DropDownList ID=&quot;droplistDistrito&quot; CssClass=&quot;item17&quot;  runat=&quot;server&quot; Height=&quot;30px&quot;&gt;
         &lt;asp:ListItem Text=&quot;Seleccione&quot;&gt;&lt;/asp:ListItem&gt;
        &lt;/asp:DropDownList&gt;
         &lt;div runat=&quot;server&quot; id=&quot;checkProvincia&quot;  class=&quot;mensaje req6 diseñoReqObli&quot;&gt;
           &lt;div runat=&quot;server&quot; id=&quot;mensaje6&quot; class=&quot;iconoMensaje&quot;&gt;
          &lt;i class=&quot;fa fa-exclamation-circle fa-2x&quot; aria-hidden=&quot;true&quot; &gt;&lt;/i&gt;
        &lt;/div&gt;
        &lt;div runat=&quot;server&quot; id=&quot;txtMensaje6&quot; style=&quot;margin-top:5px;&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
        &lt;div runat=&quot;server&quot; id=&quot;checkCanton&quot;  class=&quot;mensaje req7 diseñoReqObli&quot;&gt;
           &lt;div runat=&quot;server&quot; id=&quot;mensaje7&quot; class=&quot;iconoMensaje&quot;&gt;
          &lt;i class=&quot;fa fa-exclamation-circle fa-2x&quot; aria-hidden=&quot;true&quot; &gt;&lt;/i&gt;
        &lt;/div&gt;
        &lt;div runat=&quot;server&quot; id=&quot;txtMensaje7&quot; style=&quot;margin-top:5px;&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
          &lt;div runat=&quot;server&quot; id=&quot;checkDistrito&quot;  class=&quot;mensaje req8 diseñoReqObli&quot;&gt;
           &lt;div runat=&quot;server&quot; id=&quot;mensaje&quot; class=&quot;iconoMensaje&quot;&gt;
          &lt;i class=&quot;fa fa-exclamation-circle fa-2x&quot; aria-hidden=&quot;true&quot; &gt;&lt;/i&gt;
        &lt;/div&gt;
        &lt;div runat=&quot;server&quot; id=&quot;txtMensaje8&quot; style=&quot;margin-top:5px;&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
          
        &lt;/div&gt;
        &lt;/ContentTemplate&gt;
       &lt;/asp:UpdatePanel&gt;
  
  
  </code></pre>
  <p>Script</p>
  <pre><code> provincia.addEventListener('change', (e) =&gt; {
          e.preventDefault();
          PageMethods.Provincia(provincia.value);
          console.log(provincia.value);
      })
  </code></pre>
  <p>code behind</p>
  <pre><code>   [System.Web.Services.WebMethod()]
          [System.Web.Script.Services.ScriptMethod()]
          public static void Provincia(string dato)
          {
              MessageBox.Show(dato);
              DropDownList dropCanton = new DropDownList();
              dropCanton = HttpContext.Current.Session[&quot;dropCanton&quot;] as DropDownList;
  
              if (dato != &quot;Seleccione&quot;)
              {
                  int idProvincia = int.Parse(dato);
                  _servicio2 = _servicio2 ?? new Servicio&lt;Canton&gt;();
                  dropCanton.DataTextField = &quot;nom_Canton&quot;;
                  dropCanton.DataValueField = &quot;cod_Canton&quot;;
                  dropCanton.DataSource = _servicio2.TraerTodoEspecificoPor(new Query&lt;Canton&gt; { Where = x =&gt; x.cod_Provincia == idProvincia });
                  dropCanton.DataBind();
                  dropCanton.Items.Insert(0, &quot;Seleccione&quot;);
                  dropCanton.SelectedIndex = 0;
                 
              }
          }
  </code></pre>
  <p>Page_load</p>
  <pre><code>  protected void Page_Load(object sender, EventArgs e)
          {
              Session[&quot;dropCanton&quot;] = this.droplistCanton;
  
          }
  </code></pre>