protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //populate typeID drop down list (dlTypeID) with every TypeID RoomHandler roomHandler = new RoomHandler(); dlTypeID.DataSource = roomHandler.GetTypeList(); dlTypeID.DataTextField = "Name"; dlTypeID.DataValueField = "TypeID"; dlTypeID.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { RoomHandler roomHandler = new RoomHandler(); Room room = new Room(); int roomID = Convert.ToInt32(Session["EditRoom"]); if (!Page.IsPostBack) { //populate typeID drop down list (dlTypeID) with every TypeID dlRoomType.DataSource = roomHandler.GetTypeList(); dlRoomType.DataTextField = "Name"; dlRoomType.DataValueField = "TypeID"; dlRoomType.DataBind(); //get room data and populate data fields for editing room = roomHandler.GetRoomDetails(roomID); lblRoomNo.Text = "Current picture for room " + room.RoomNo + ": "; txtRoomNo.Text = room.RoomNo; txtDescription.Text = room.Description; dlRoomType.SelectedValue = room.TypeID.ToString(); if (room.WifiStatus == "Yes") cbWifi.Checked = true; if (room.AirconStatus == "Yes") cbAircon.Checked = true; if (room.RoomserviceStatus == "Yes") cbRoomservice.Checked = true; if (room.TelevisionStatus == "Yes") cbTelevision.Checked = true; dlStatus.SelectedValue = room.Status; if (room.Picture != "" && room.Picture != null && room.Picture != " ") litRoomPicture.Text = "<a href=\"" + "." + room.Picture.Replace('\\', '/') + "\" data-lightbox=\"image\">View Picture</a>"; else litRoomPicture.Text = "No picture"; picName = room.Picture; originalRoomNo = room.RoomNo; } }