protected void Page_Load(object sender, EventArgs e)
        {
            using (Datos.AlmacenEntities modelo = new Datos.AlmacenEntities())
            {
                var cartegoria = (from c in modelo.Bodega
                                  select new { c.idBodega, c.nombre }).ToList();

                DropDownList1.DataValueField = "idBodega";
                DropDownList1.DataTextField  = "nombre";
                DropDownList1.DataSource     = cartegoria;
                DropDownList1.DataBind();
                // List<Bodega> lista = modelo.Bodega.ToList();
                // DropDownList1.DataSource = lista;
                // DropDownList1.DataTextField = "nombre" ;
                // //DropDownList1.DataValueField = "idBodega";
                // DropDownList1.DataBind();
                //// DropDownList1.Items.Insert(0, new ListItem("--- Seleccione Bodega ---", "0"));
            }
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (Datos.AlmacenEntities m = new Datos.AlmacenEntities())
     {
     }
 }