private void cargar_DropDownList_DEPARTAMENTO_REP_LEGAL() { DropDownList_DEP_CC_REP_LEGAL.Items.Clear(); departamento _departamento = new departamento(Session["idEmpresa"].ToString()); DataTable tablaDepartamentos = _departamento.ObtenerTodasLosDepartamentos(); ListItem item = new ListItem("Seleccione Departamento", ""); DropDownList_DEP_CC_REP_LEGAL.Items.Add(item); foreach (DataRow fila in tablaDepartamentos.Rows) { item = new ListItem(fila["NOMBRE"].ToString(), fila["ID_DEPARTAMENTO"].ToString()); DropDownList_DEP_CC_REP_LEGAL.Items.Add(item); } DropDownList_DEP_CC_REP_LEGAL.DataBind(); }
private void cargar_DropDownList_DEPARTAMENTO(String id) { DropDownList_DEPARTAMENTO.Items.Clear(); departamento _departamento = new departamento(Session["idEmpresa"].ToString()); DataTable tablaDepartamentos = _departamento.ObtenerDepartamentosPorIdRegional(id); ListItem item = new ListItem("Seleccione...", ""); DropDownList_DEPARTAMENTO.Items.Add(item); foreach (DataRow fila in tablaDepartamentos.Rows) { item = new ListItem(fila["NOMBRE"].ToString(), fila["ID_DEPARTAMENTO"].ToString()); DropDownList_DEPARTAMENTO.Items.Add(item); } DropDownList_DEPARTAMENTO.DataBind(); }
private void cargar_DropDownList_DEPARTAMENTO(DropDownList drop) { drop.Items.Clear(); departamento _departamento = new departamento(Session["idEmpresa"].ToString()); DataTable tablaDepartamentos = _departamento.ObtenerTodasLosDepartamentos(); System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem("Seleccione...", ""); drop.Items.Add(item); foreach (DataRow fila in tablaDepartamentos.Rows) { item = new System.Web.UI.WebControls.ListItem(fila["NOMBRE"].ToString(), fila["ID_DEPARTAMENTO"].ToString()); drop.Items.Add(item); } drop.DataBind(); }