Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        basket = ShoppingBasket.GetBasket();

        if (basket.Count > 0)
        {
            for (int i = 0; i < basket.Count; ++i)
            {
                BasketItem         item = basket[i];
                HtmlGenericControl html = item.ToHtml();
                BasketContent.Controls.Add(html);
            }
            lblSubtotal.Text = "Total Price: <strong>&pound;" + Server.HtmlEncode(basket.SubTotal.ToString()) + "<strong>";
        }
        else
        {
            btnCheckout.Visible = false;
            HtmlGenericControl h2 = new HtmlGenericControl("h2")
            {
                InnerText = "Your Basket is Empty"
            };
            BasketContent.Controls.Add(h2);
        }
    }