Beispiel #1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                // Calculate end-user's shopping cart ID
                funstore.cartDB cart   = new funstore.cartDB();
                String          cartId = cart.GetShoppingCartId();

                // Populate datagrid with shopping cart data
                this.DataGrid1.DataSource = cart.GetItems(cartId);
                this.DataGrid1.DataBind();

                // Update total price label
                lbltotal.Text = String.Format("{0:c}", cart.GetTotal(cartId));
            }
        }
Beispiel #2
0
        void PopulateShoppingCartList()
        {
            funstore.cartDB cart = new funstore.cartDB();

            // Obtain current user's shopping cart ID
            String cartId = cart.GetShoppingCartId();

            // If no items, hide details and display message
            if (cart.GetItemCount(cartId) == 0)
            {
                Panel1.Visible = false;
                lberror.Text   = "There are currently no items in your shopping cart.";
            }
            else
            {
                // Databind Gridcontrol with Shopping Cart Items
                this.DataGrid1.DataSource = cart.GetItems(cartId);
                this.DataGrid1.DataBind();

                //Update Total Price Label
                lblTotal.Text = String.Format("{0:c}", cart.GetTotal(cartId));
            }
        }