Exemple #1
0
        protected void CargarEmpresas()
        {
            try
            {
                int modo = 11;
                ProyectosBehaivor EmpresasProyectosItem = new ProyectosBehaivor();
                EmpresasProyectosItem.Connection = ConectionBD;
                List <ProyectosDatos> empresasProyLst = EmpresasProyectosItem.CN_fn_EmpresasProyectosSel(Id, modo);

                if (empresasProyLst.Count > 0)
                {
                    cmbEmpresaContacto1.DataTextField  = "nombreEmpresa";
                    cmbEmpresaContacto1.DataValueField = "IdEmpresa";
                    cmbEmpresaContacto1.DataSource     = empresasProyLst;
                    cmbEmpresaContacto1.DataBind();
                    cmbEmpresaContacto1.Items.Insert(0, new ListItem("Seleccione una empresa", "0"));

                    cmbEmpresaContacto2.DataTextField  = "nombreEmpresa";
                    cmbEmpresaContacto2.DataValueField = "IdEmpresa";
                    cmbEmpresaContacto2.DataSource     = empresasProyLst;
                    cmbEmpresaContacto2.DataBind();
                    cmbEmpresaContacto2.Items.Insert(0, new ListItem("Seleccione una empresa", "0"));

                    cmbEmpresaContacto3.DataTextField  = "nombreEmpresa";
                    cmbEmpresaContacto3.DataValueField = "IdEmpresa";
                    cmbEmpresaContacto3.DataSource     = empresasProyLst;
                    cmbEmpresaContacto3.DataBind();
                    cmbEmpresaContacto3.Items.Insert(0, new ListItem("Seleccione una empresa", "0"));
                }
            }
            catch (Exception ex)
            {
                mensajeErrorlbl.Visible   = true;
                mensajeErrorlbl.ForeColor = System.Drawing.Color.Red;
                mensajeErrorlbl.Text      = "!Error / Cargar Empresa: " + ex.Message + "!";
            }
        }