public void LoadRecord(int iRowID) { hidRowSelected.Value = ""; GridViewRow gvRow = gvWaivers.Rows[iRowID]; if (gvRow != null) { gvWaivers.SelectedIndex = iRowID; HiddenField PlayerWaiverID = gvRow.FindControl("hidPlayerWaiverID") as HiddenField; if (PlayerWaiverID != null) { int iWaiverID; if (int.TryParse(PlayerWaiverID.Value, out iWaiverID)) { hidPlayerWaiverID.Value = iWaiverID.ToString(); Classes.cPlayerWaiver Waiver = new Classes.cPlayerWaiver(iWaiverID, Master.UserName); lblWaiverText.Text = Waiver.WaiverText; tbWaiverComment.Text = Waiver.PlayerNotes; cbxAgree.Checked = false; cbxDisagree.Checked = false; if (Waiver.AcceptedDate.HasValue) { cbxAgree.Checked = true; } else if (Waiver.DeclinedDate.HasValue) { cbxDisagree.Checked = true; } foreach (TableCell tCell in gvRow.Cells) { tCell.Font.Bold = true; // tCell.BackColor = System.Drawing.Color.LightBlue; } hidRowSelected.Value = iRowID.ToString(); } } } }
protected void btnSaveComments_Click(object sender, EventArgs e) { int iPlayerWaiverID; if (int.TryParse(hidPlayerWaiverID.Value, out iPlayerWaiverID)) { Classes.cPlayerWaiver Waiver = new Classes.cPlayerWaiver(iPlayerWaiverID, Master.UserName); Waiver.PlayerNotes = tbWaiverComment.Text; Waiver.AcceptedDate = null; Waiver.DeclinedDate = null; if (cbxAgree.Checked) { Waiver.AcceptedDate = DateTime.Today; } else if (cbxDisagree.Checked) { Waiver.DeclinedDate = DateTime.Today; } Waiver.Save(Master.UserName, Master.UserID); } lblModalMessage.Text = "Your information has been saved."; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModalMessage();", true); }