Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //get id from query string if not empty
        if (Request.QueryString["id"] != null)
        {
            int            id = Convert.ToInt16(Request.QueryString["id"]);
            List <Product> p  = (List <Product>)Session["Products"];

            foreach (Product product in p)
            {
                //if the product in product list matches id display product information
                if (product.ProdID == id)
                {
                    lblPrice.Text         = "£" + Convert.ToString(product.ProdPrice);
                    lblProdTitle.Text     = product.ProdName;
                    imgProdImage.ImageUrl = product.ProdImage;
                    lblSubHeading.Text    = product.ProdDescription;
                    lblDescription.Text   = product.ProdDescriptionFull;

                    lblCategory.Text = CartFunctions.getCategory(product.ProdID);
                }
            }
        }
    }