protected void btnSubmit_Click(object sender, EventArgs e) { if (lbxGroups.SelectedIndex == -1) { DataLayer dl = new DataLayer(); dl.AddGroup(tbxGroupName.Text, rteBody.Value, ddlState.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Group Added"; Session["resultMessage"] = "Group Added Successfuly"; Session["resultReturnURL"] = "ManageGroups.aspx"; Response.Redirect("Result.aspx"); } else { if (cbxDeleteGroup.Checked) { DataLayer dl = new DataLayer(); dl.DeleteGroup(lbxGroups.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Group Deleted"; Session["resultMessage"] = "Group Deleted Successfuly"; Session["resultReturnURL"] = "ManageGroups.aspx"; Response.Redirect("Result.aspx"); } else { DataLayer dl = new DataLayer(); dl.UpdateGroup(lbxGroups.SelectedValue, tbxGroupName.Text, rteBody.Value, ddlState.SelectedValue); Session["resultColor"] = "#007700"; Session["resultTitle"] = "Group Updated"; Session["resultMessage"] = "Group Updated Successfuly"; Session["resultReturnURL"] = "ManageGroups.aspx"; Response.Redirect("Result.aspx"); } } }