Exemplo n.º 1
0
        // Remove specified cart item from the shopping cart
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            BLShoppingCart cart = Session["Cart"] as BLShoppingCart;
            CheckBox       selected;

            ListViewDataItem currDataItem;

            // Finds specified cart item within the overall cart and removes it
            for (int i = ItemList.Items.Count - 1; i >= 0; i--)
            {
                currDataItem = ItemList.Items[i];
                selected     = currDataItem.FindControl("cbxRemove") as CheckBox;
                if (selected.Checked)
                {
                    cart.Items.RemoveAt(ItemList.Items[i].DisplayIndex);
                    cart.calculate();
                }
            }
            Response.Redirect("~/UL/Cart");
        }