示例#1
0
        protected void GetRoomsList()
        {
            List <Room> RoomsList = new List <Room>();

            using (SmartHouseContext context = new SmartHouseContext())
            {
                RoomsList = context.Rooms.ToList();
            }

            foreach (Room room in RoomsList)
            {
                RoomControl c = (RoomControl)Page.LoadControl(@"~\Controls\RoomControl.ascx");
                c.Initialize(room.Name, room.Id);
                PlaceHolder1.Controls.Add(c);
            }
        }