protected void Page_Load(object sender, EventArgs e) { Session["total"] = String.Empty; Session["discountTotal"] = String.Empty; Session["discountedTotal"] = String.Empty; decimal total = 0; string promoCode = (string)Session["promoCode"]; items = (List <CartItem>)Session["cartItems"]; if (items.Count <= 0) { Response.Redirect("~/"); } else { foreach (var item in items) { int bookId = BusinessLogic.GetBookID(item.Isbn); string title = BusinessLogic.GetBookTitle(bookId); int quantity = item.Quantity; decimal price = BusinessLogic.GetPrice(bookId); decimal discount = (BusinessLogic.GetPrice(bookId) - BusinessLogic.GetDiscountedPrice(bookId)) * quantity; decimal subtotal = price * quantity - discount; total += subtotal; CartModel model = new CartModel(title, price, quantity, discount, subtotal); models.Add(model); } Session["total"] = total.ToString("c2"); Session["discountTotal"] = (total - BusinessLogic.GetTotalPromoPriceFromCart(items, promoCode)).ToString("c2"); Session["discountedTotal"] = BusinessLogic.GetTotalPromoPriceFromCart(items, promoCode).ToString("c2"); gvCart.DataSource = models; gvCart.DataBind(); } }