protected void Button1_Click1(object sender, EventArgs e) { if (!pageRefresh) { if (Request.QueryString["param1"] != null) { for (int i = 0; i < test_method().Count(); i++) { if (test_method()[i].getProductID() == Convert.ToInt32(Request.QueryString["param1"])) { int id = Convert.ToInt32(Request.QueryString["param1"]); SessionValues sv = new SessionValues(); sv.addToCart(id); break; } else { } } } } }
protected void Button1_Command(object sender, CommandEventArgs e) { if (!pageRefresh) { int value = Int32.Parse(e.CommandArgument.ToString()); //((List<FoodStoreV2.CSharpClasses.Cart>)Session["cartList"]).Add(new FoodStoreV2.CSharpClasses.Cart(value, 1000)); int id = Convert.ToInt32(e.CommandArgument); // Do something with id //Response.Redirect("ProductPage_WebForm?param1=" + id.ToString() + ""); SessionValues sv = new SessionValues(); sv.addToCart(id); } }