protected void unload_Click(Object sender, EventArgs e) { if (flag) { Response.Redirect("~/Login.aspx"); return; } Button thisBtn = sender as Button; HiddenField hidden = thisBtn.Parent.Controls[2] as HiddenField; int id = int.Parse(hidden.ID); Order o = Session["ActiveOrder"] as Order; ConnectionClass.removeCartItem(id, o.ID); thisBtn.Text = "Removed from Cart"; //thisBtn.Enabled = false; thisBtn.CssClass = "btn btn-danger btn-disabled"; thisBtn.Visible = false; Button neighbor = thisBtn.Parent.Controls[0] as Button; neighbor.Text = "Add to Cart"; neighbor.Enabled = true; }
protected void btnRemove_Click(Object sender, EventArgs e) { Button thisbtn = sender as Button; HiddenField hf = thisbtn.Parent.Controls[3] as HiddenField; int id = int.Parse(hf.Value); ConnectionClass.removeCartItem(id); Response.Redirect("~/Cart.aspx"); }