/// <summary> /// Metodo para llenar el combo box de paises /// </summary> public void llenarComboPais() { Comando <bool, List <String> > comando = FabricaComandos.CrearComandoConsultarListaPaises(); Dictionary <string, string> options = new Dictionary <string, string>(); options.Add("-1", "Selecciona un pais"); try { List <String> lista = comando.Ejecutar(true); foreach (String pais in lista) { options.Add(pais, pais); } } catch (Exception ex) { vista.alertaClase = RecursoInterfazM2.Alerta_Clase_Error; vista.alertaRol = RecursoInterfazM2.Alerta_Rol; vista.alerta = RecursoInterfazM2.Alerta_Html + ex.Message + RecursoInterfazM2.Alerta_Html_Final; } vista.comboPais.DataSource = options; vista.comboPais.DataTextField = "value"; vista.comboPais.DataValueField = "key"; vista.comboPais.DataBind(); vista.comboPais.Enabled = true; }
/// <summary> /// metodo para llenar el combo de paises /// </summary> public void llenarComboPais() { Comando <bool, List <String> > comando = FabricaComandos.CrearComandoConsultarListaPaises(); Dictionary <string, string> options = new Dictionary <string, string>(); options.Add("-1", "Selecciona un pais"); try { List <String> resultado = comando.Ejecutar(true); foreach (String pais in resultado) { options.Add(pais, pais); } } catch (Exception ex) { throw ex; } vista.comboPais.DataSource = options; vista.comboPais.DataTextField = "value"; vista.comboPais.DataValueField = "key"; vista.comboPais.DataBind(); vista.comboPais.Enabled = true; }