protected void Page_Load(object sender, EventArgs e)
        {
            string idString = "";
            int    id;

            // get id from URL segment
            try
            {
                var segments = Request.GetFriendlyUrlSegments();
                idString = segments[0];
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
                Debug.Write(ex.ToString());
                lblError.Text = "Error URL";
            }

            // get id from query string and try to parse
            if (!string.IsNullOrEmpty(idString) && int.TryParse(idString, out id))
            {
                //call product from Database
                ProductBL db = new ProductBL();
                SizeBL    sb = new SizeBL();

                if (IsPostBack)
                {
                    labelPrice.Text  = sb.GetPriceBySize(id, Convert.ToInt32(unitDropDownList.SelectedValue)).ToString();
                    totalAmount.Text = GetTotalAmount(labelPrice.Text, quantityDropDownList.SelectedValue.ToString());
                    lblResult.Text   = "";
                }
                if (!IsPostBack)
                {
                    // retrieve a prodcut from our db
                    var            product        = db.GetProduct(id);
                    var            details        = sb.GetDetails(product.GetId());
                    List <SizeDTO> productDetails = details.ToList();

                    //only display available products to the customer
                    if (product != null && product.GetStatus() == 1)
                    {
                        // set up detail page elements with data from the product
                        headerTitle.Text        = product.GetName();
                        headerSubtitle.Text     = product.GetShortInfo();
                        descriptionLabel.Text   = product.GetInfo();
                        destinationImg.ImageUrl = product.GetImgPath();
                        nameLabel.Text          = product.GetName();
                        labelProduct.Text       = product.GetProductType();
                        labelProducer.Text      = product.GetProducer();
                        for (int i = 0; i < productDetails.Count; i++)
                        {
                            unitDropDownList.Items.Add(productDetails[i].GetSize().ToString());
                        }
                        labelPrice.Text = sb.GetPriceBySize(id, Convert.ToInt32(unitDropDownList.SelectedValue)).ToString();
                        for (int i = 1; i < product.GetStock(); i++)
                        {
                            quantityDropDownList.Items.Add(i.ToString());
                        }
                        if (product.GetStock() <= 5)
                        {
                            lowStock.Text = $"Low stock. Only {product.GetStock()} available";
                        }
                        if (product.GetProductType() == "Cheese")
                        {
                            lblUnit.Text = "(gr)";
                        }
                        else
                        {
                            lblUnit.Text = "(ml)";
                        }
                    }
                    else
                    {
                        headerTitle.Text = "Product currently not available";
                    }
                }
            }
            else
            {
                lblError.Text = "Error URL";
            }
        }