protected void btnSubmit_Click(object sender, EventArgs e) { if (lbxFAQs.SelectedIndex == -1) { DataLayer dl = new DataLayer(); dl.AddFAQ(tbxQuestion.Text, tbxAnswer.Text.Replace("\r", "<br />").Replace("\n", "")); Session["resultColor"] = "#007700"; Session["resultTitle"] = "FAQ Added"; Session["resultMessage"] = "FAQ Added Successfuly"; Session["resultReturnURL"] = "ManageFAQ.aspx"; Response.Redirect("Result.aspx"); } else { if (cbxDeleteFAQ.Checked) { DataLayer dl = new DataLayer(); dl.DeleteFAQ(Convert.ToInt32(lbxFAQs.SelectedValue)); Session["resultColor"] = "#007700"; Session["resultTitle"] = "FAQ Deleted"; Session["resultMessage"] = "FAQ Deleted Successfuly"; Session["resultReturnURL"] = "ManageFAQ.aspx"; Response.Redirect("Result.aspx"); } else { DataLayer dl = new DataLayer(); dl.UpdateFAQ(Convert.ToInt32(lbxFAQs.SelectedValue), tbxQuestion.Text, tbxAnswer.Text.Replace("\r", "<br />").Replace("\n", "")); Session["resultColor"] = "#007700"; Session["resultTitle"] = "FAQ Updated"; Session["resultMessage"] = "FAQ Updated Successfuly"; Session["resultReturnURL"] = "ManageFAQ.aspx"; Response.Redirect("Result.aspx"); } } }