protected void DropDownListdepartamentoempresa_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownListmunicipioempresa.Items.Clear(); DropDownListmunicipioempresa.Items.Add(new ListItem("Seleccione", "Seleccione")); munic.departamento_iddepartamento = Validar.validarselected(DropDownListdepartamentoempresa.SelectedValue); DropDownListmunicipioempresa.DataSource = Validar.Consulta(munic.ConsultarMunicipioIdDepartamento(munic)); DropDownListmunicipioempresa.DataTextField = "municipio"; DropDownListmunicipioempresa.DataValueField = "idmunicipio"; DropDownListmunicipioempresa.DataBind(); } catch (Exception ex) { textError.InnerHtml = ex.Message; Alerta.CssClass = "alert alert-error"; Alerta.Visible = true; } }
private void cargarMunicipiosempresa(string dat) { try { DropDownListmunicipioempresa.Items.Clear(); DropDownListmunicipioempresa.Items.Add(new ListItem("Seleccione", "Seleccione")); munic.departamento_iddepartamento = dat; DropDownListmunicipioempresa.DataSource = Validar.Consulta(munic.ConsultarMunicipioIdDepartamento(munic)); DropDownListmunicipioempresa.DataTextField = "municipio"; DropDownListmunicipioempresa.DataValueField = "idmunicipio"; DropDownListmunicipioempresa.DataBind(); } catch (Exception ex) { textError.InnerHtml = ex.Message; Alerta.CssClass = "alert alert-error"; Alerta.Visible = true; } }