protected void DropDownListIndex_OnChanged(object sender, EventArgs e) { ExtendBLL.Location location = new ExtendBLL.Location(); DataSet ds = new DataSet(); int LabID=0; if(LabDDL.SelectedValue!="0") { LabID = int.Parse(LabDDL.SelectedValue); } ds = location.GetRoomInfo(LabID, LocationNameTBX.Text, CampusTBX.Text, BuildingNameTBX.Text, FloorTBX.Text, RoomNumTBX.Text); LabRoomGridView.DataSource = ds; LabRoomGridView.DataBind(); }
//ɾ��ʵ���÷���Ϣ protected void Delete_OnClick(object sender, EventArgs e) { ExtendBLL.Location loc = new ExtendBLL.Location(); bool IsDel = false; for (int i = 0; i < LabRoomGridView.Rows.Count; i++) { CheckBox checkBox = (CheckBox)LabRoomGridView.Rows[i].FindControl("RoomCheckBox"); if (checkBox.Checked == true) { IsDel = true; int ID = int.Parse(LabRoomGridView.DataKeys[i].Value.ToString()); List<string> strID = new List<string>(); List<string> strTable = new List<string>(); List<string> strColName = new List<string>(); #region �÷� strID.Add(ID.ToString()); strTable.Add("Location"); strColName.Add("ID"); #endregion #region �γ̰��� strID.Add(ID.ToString()); strTable.Add("Arrangement"); strColName.Add("LocationID"); #endregion try { loc.DeleteLocation(strID, strTable, strColName); } catch { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('ɾ��ʧ��!')</script>"); return; } } } if (IsDel) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script type='text/javascript'>alert('ɾ���ɹ�!')</script>"); LabRoom_BindData(int.Parse(LabDDL.SelectedValue), LocationNameTBX.Text, CampusTBX.Text, BuildingNameTBX.Text, FloorTBX.Text, RoomNumTBX.Text); } }
//��LabRoomGridView protected void LabRoom_BindData(int LabID,string LocalName,string Campus,string BuildingName,string Floor,string RoomNum) { Location location = new Location(); DataSet ds = new DataSet(); ds = location.GetRoomInfo(LabID, LocalName, Campus, BuildingName, Floor, RoomNum); LabRoomGridView.DataSource = ds; LabRoomGridView.DataBind(); }