public void FillPlaceholder() { ArrayList cart = new ArrayList(); cart = (ArrayList)Session["Cart"]; if (cart.Count > 0) { checkout_items_placeholder.Controls.Clear(); Table tblRecords = new Table(); checkout_items_placeholder.Controls.Add(tblRecords); ItemActions pxy = new ItemActions(); ArrayList cartItems = pxy.GetCartItems(cart); Decimal totalPrice = 0; checkout_cart_header.Text = "Cart(" + cartItems.Count + ")"; for (int i = 0; i < cartItems.Count; i++) { Item tempItem = (Item)cartItems[i]; TableRow row = new TableRow(); TableCell productName = new TableCell(); TableCell productPrice = new TableCell(); productName.Text = tempItem.Name; productPrice.Text = "$" + tempItem.Price.ToString(); totalPrice += tempItem.Price; row.Cells.Add(productName); row.Cells.Add(productPrice); tblRecords.Rows.Add(row); } checkout_price.Text = "$" + totalPrice.ToString(); } else { Response.Write("<script>alert('Cart is empty')</script>"); } }
public void Refresh() { rpt_Items.Visible = false; ArrayList cartlist = (ArrayList)Session["Cart"]; if (cartlist == null) { Response.Write("Nothing is in your cart."); } else { ItemActions pxy = new ItemActions(); ArrayList cartItems = pxy.GetCartItems(cartlist); rpt_Items.DataSource = null; rpt_Items.DataSource = cartItems; rpt_Items.DataBind(); rpt_Items.Visible = true; } }