예제 #1
0
 protected void DropDownListpais_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         DropDownListdepartamento.Items.Clear();
         DropDownListdepartamento.Items.Add(new ListItem("Seleccione", "Seleccione"));
         depart.pais_idpais = Validar.validarselected(DropDownListpais.SelectedValue);
         DropDownListdepartamento.DataSource     = Validar.Consulta(depart.ConsultarDepartamentoIdPais(depart));
         DropDownListdepartamento.DataTextField  = "departamento";
         DropDownListdepartamento.DataValueField = "iddepartamento";
         DropDownListdepartamento.DataBind();
     }
     catch (Exception ex)
     {
         textError.InnerHtml = ex.Message;
         Alerta.CssClass     = "alert alert-error";
         Alerta.Visible      = true;
     }
 }
예제 #2
0
        private void cargarDepartamentos(string dat)
        {
            try
            {
                DropDownListdepartamento.Items.Clear();

                DropDownListdepartamento.Items.Add(new ListItem("Seleccione", "Seleccione"));
                depart.pais_idpais = dat;
                DropDownListdepartamento.DataSource     = Validar.Consulta(depart.ConsultarDepartamentoIdPais(depart));
                DropDownListdepartamento.DataTextField  = "departamento";
                DropDownListdepartamento.DataValueField = "iddepartamento";
                DropDownListdepartamento.DataBind();
            }
            catch (Exception ex)
            {
                textError.InnerHtml = ex.Message;
                Alerta.CssClass     = "alert alert-error";
                Alerta.Visible      = true;
            }
        }