/// <summary> /// Update list of rooms on change of content /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlroomDropDown_SelectedIndexChanged(object sender, EventArgs e) { BuildingModel bm = new BuildingModel(); //Selects single selected building bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); int id = bm.BuildingID; //Pull all rooms from the database rooms = RoomBL.fillRoomsList(id); RoomModel rm = new RoomModel(); //Selects single selected building rm = rooms.Where(r => r.RoomID == Int32.Parse(roomDropdown.Text)).FirstOrDefault(); int rid = rm.RoomID; tables = TableBL.FillTableList(rid); //Update values from user input tableDropdown.DataSource = tables; tableDropdown.DataValueField = "TableID"; tableDropdown.DataTextField = "TableID"; tableDropdown.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); lblRoomHeading.Text = "Room: " + RoomBL.getRoomByID(ID).RoomName; tables = TableBL.FillTableList(ID); if (!IsPostBack) //need this to stop it reverting to the top value every button click { tableDropdown.DataSource = tables; tableDropdown.DataValueField = "TableID"; tableDropdown.DataTextField = "TableID"; tableDropdown.DataBind(); } if (tableDropdown.Items.Count < 1) { lblAboveDropdown.Text = "No tables currently available"; tableDropdown.Visible = false; goToTableButton.Visible = false; } // List <TableModel> drawtables = new List <TableModel>(); drawtables = TableBL.FillTableList(ID); int iLenght = drawtables.Count(); int x = 0; /*/////////////////////// * TextBox textBox = new TextBox(); * textBox.ID = "textBox1"; * textBox.Text = iLenght.ToString(); * div1.Controls.Add(textBox); * ////////////////////////*/ while (x < iLenght) { createImageTable(Convert.ToInt32(drawtables[x].TableID.ToString()), drawtables[x].Category); x++; } }