protected void RemoveRoommate_Click(object sender, EventArgs e) { LinkButton lb = (LinkButton)sender; GridViewRow gvRow = (GridViewRow)lb.NamingContainer; int rowID = gvRow.RowIndex; //+1; if (ViewState["CurrentTable"] != null) { DataTable dt = (DataTable)ViewState["CurrentTable"]; if (dt.Rows.Count >= 1) { if (gvRow.RowIndex <= dt.Rows.Count - 1) { //Remove the Selected Row data dt.Rows.Remove(dt.Rows[rowID]); } } //Store the current data in ViewState for future reference ViewState["CurrentTable"] = dt; //Re bind the GridView for the updated data GridviewRoommatelist.DataSource = dt; GridviewRoommatelist.DataBind(); } }
protected void CreateRommateButton_Click(object sender, EventArgs e) { if (validateemail() == true) { GridviewRoommatelist.DataSource = CreateDataSource(); GridviewRoommatelist.DataBind(); clear(); } }
protected void CreateRommateButton_Click(object sender, EventArgs e) { GridviewRoommatelist.DataSource = CreateDataSource(); GridviewRoommatelist.DataBind(); clear(); if (ViewState["CurrentTable"] != null) { // SaveRommateButton.Enabled = true; } else { // SaveRommateButton.Enabled = false; } }
protected void LBSelectRoom_Click(object sender, EventArgs e) { Step1.Visible = false; DromDetails.Visible = true; Step2.Visible = false; Step3.Visible = true; RoomNumber.Text = DrpDromRooms.SelectedItem.Text.Trim(); Guid roomNumber; if (Guid.TryParse(DrpDromRooms.SelectedValue.Trim(), out roomNumber)) { List <User> userlist = User.SelectUserByBaseHouseRoomId("BaseHouseRoomId", roomNumber, "rolename", "student"); GridviewRoommatelist.DataSource = userlist; GridviewRoommatelist.DataBind(); } }