Пример #1
0
        //*******************************************************
        //
        // The Page_Load event on this page is used to fetch details
        // about the product to review.  It then updates UI elements
        // with the results.
        //
        // Note that the product to review is specified using
        // a querystring argument to the page.
        //
        //*******************************************************

        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Page.IsPostBack != true)
            {
                // Obtain ProductID of Product to Review
                int productID = Int32.Parse(Request["productID"]);

                // Populate Product Name on Page
                IBuySpy.ProductsDB products = new IBuySpy.ProductsDB();
                ModelName.Text = products.GetProductDetails(productID).ModelName;

                // Store ProductID in Page State to use on PostBack
                ViewState["productID"] = productID;
            }
        }
Пример #2
0
        //*******************************************************
        //
        // The Page_Load event on this page is used to obtain
        // product information from a database and then update
        // UI elements with them.
        //
        // Note that this page is output cached at 1 minute
        // intervals.  This eliminates the need to hit the database
        // on each request to the page.
        //
        //*******************************************************

        private void Page_Load(object sender, System.EventArgs e)
        {
            // Obtain ProductID from QueryString
            int ProductID = Int32.Parse(Request.Params["ProductID"]);

            // Obtain Product Details
            IBuySpy.ProductsDB     products         = new IBuySpy.ProductsDB();
            IBuySpy.ProductDetails myProductDetails = products.GetProductDetails(ProductID);

            // Update Controls with Product Details
            desc.Text                = myProductDetails.Description;
            UnitCost.Text            = String.Format("{0:c}", myProductDetails.UnitCost);
            ModelName.Text           = myProductDetails.ModelName;
            ModelNumber.Text         = myProductDetails.ModelNumber.ToString();
            ProductImage.ImageUrl    = "ProductImages/" + myProductDetails.ProductImage;
            addToCart.NavigateUrl    = "AddToCart.aspx?ProductID=" + ProductID;
            ReviewList.ProductID     = ProductID;
            AlsoBoughtList.ProductID = ProductID;
        }