protected void btnSubmit_Click(object sender, EventArgs e) { if (GetUrlParamType() == UrlParamType.View) { Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "edit")); } else if (GetUrlParamType() == UrlParamType.Edit) { if (!IsValidFormID()) { HideTableAndSetErrorMessage(); return; } Patient patient = PatientDB.GetByID(GetFormID()); if (patient == null) { HideTableAndSetErrorMessage("Invalid Patient ID"); return; } PatientDB.UpdateFlashingText(patient.PatientID, txtFlashingText.Text, Convert.ToInt32(Session["StaffID"]), DateTime.Now); //close this window Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.href=window.opener.location.href;self.close();</script>"); } else if (GetUrlParamType() == UrlParamType.Add) { if (!IsValidFormID()) { HideTableAndSetErrorMessage(); return; } Patient patient = PatientDB.GetByID(GetFormID()); if (patient == null) { HideTableAndSetErrorMessage("Invalid Patient ID"); return; } PatientDB.UpdateFlashingText(patient.PatientID, txtFlashingText.Text, Convert.ToInt32(Session["StaffID"]), DateTime.Now); // close this window Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.href=window.opener.location.href;self.close();</script>"); } else { HideTableAndSetErrorMessage("", "Invalid URL Parameters"); } }