protected void btnSubmit_Click(object sender, EventArgs e) { if (lbxCategories.SelectedIndex == -1) { DataLayer dl = new DataLayer(); dl.AddCategory(tbxCategory.Text, ddlParentCategory.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Article Category Added"; Session["resultMessage"] = "Article Category Added Successfuly"; Session["resultReturnURL"] = "ManageArticleCategories.aspx"; Response.Redirect("Result.aspx"); } else { if (cbxDeleteCategory.Checked) { DataLayer dl = new DataLayer(); dl.DeleteCategory(lbxCategories.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Article Category Deleted"; Session["resultMessage"] = "Article Category Deleted Successfuly"; Session["resultReturnURL"] = "ManageArticleCategories.aspx"; Response.Redirect("Result.aspx"); } else { DataLayer dl = new DataLayer(); dl.UpdateCategory(lbxCategories.SelectedValue, tbxCategory.Text, ddlParentCategory.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Article Category Updated"; Session["resultMessage"] = "Article Category Updated Successfuly"; Session["resultReturnURL"] = "ManageArticleCategories.aspx"; Response.Redirect("Result.aspx"); } } }