protected void btnSave_Click(object sender, EventArgs e) { if (state == "add") { HttpCookie AddMsgCookie = new HttpCookie("status"); AddMsgCookie.Value = "add"; AddMsgCookie.Expires = DateTime.Now.AddSeconds(6); Response.Cookies.Add(AddMsgCookie); BL.AddNewSupplier(txtFoundationName.Text, txtEmail.Text, txtCommId.Text, txtLocation.Text); Response.Redirect("Suppliers.aspx"); } else { HttpCookie UpdateMsgCookie = new HttpCookie("status"); UpdateMsgCookie.Value = "update"; UpdateMsgCookie.Expires = DateTime.Now.AddSeconds(6); Response.Cookies.Add(UpdateMsgCookie); BL.UpdateSupplier(Convert.ToInt32(Request.QueryString["id"]), txtFoundationName.Text, txtEmail.Text, txtCommId.Text, txtLocation.Text); state = "add"; Response.Redirect("Suppliers.aspx"); } }