Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // retrieve cart object from session state on every postback
     cart = CartItemsList.GetCart();
     // on initial page load, add cart items to list control
     if (!IsPostBack)
     {
         this.DisplayCart();
     }
 }
Ejemplo n.º 2
0
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                //get cart from session state and selected item from cart
                CartItemsList cart = CartItemsList.GetCart();

                if (selectedMobile != null)
                {
                    cart.AddItem(selectedMobile, Convert.ToInt32(txtQuantity.Text));
                    Response.Redirect("~/Cart.aspx");
                }
            }
        }