private void PopulateControls() { //this.Title = ShopConfiguration.SiteName + " : Shopping Cart"; // get the items in the shopping cart try { using (ShoppingCartAccess cart = new ShoppingCartAccess()) { dtCartItems = new DataTable(); dtCartItems = cart.LoadList_ShoppingCartItems(); DataTable dtAmount = cart.ShoppingCart_GetTotalAmount(); if (dtAmount.Rows.Count > 0) { lblTotalAmount.Text = "<span class=\"price\">" + dtAmount.Rows[0]["TotalAmount"].ToString() + "</span>"; lblCurrency.Text = "<span class=\"price\">" + dtAmount.Rows[0]["Currency"].ToString() + "</span>"; } } } catch (Exception ex) { lblSystemMessage.Text = "Error: " + ex.Message; } // if the shopping cart is empty... if (dtCartItems.Rows.Count == 0) { titleLabel.Text = "<span class=\"pagetitle\">Your shopping cart is empty!</span>"; grid.Visible = false; btnUpdate.Enabled = false; btnCheckOut.Enabled = false; lblTotalAmount.Text = ""; lblCurrency.Text = ""; //lblTotalAmount.Text = String.Format("{0:c}", 0); } else { grid.DataSource = dtCartItems; grid.DataBind(); titleLabel.Text = "<span class=\"pagetitle\">These are the products in your shopping cart:</span>"; grid.Visible = true; btnUpdate.Enabled = true; btnCheckOut.Enabled = true; } }