コード例 #1
0
        private void FillWebPage(int ID)
        {
            //selected Laptop from DB
            LPModel    productModel = new LPModel();
            tblProduct product      = productModel.GetProduct(ID);

            //Fill in the Textbox
            txtDes.Text = product.LP_desc;
            txtNm.Text  = product.LP_name;
            txtPrc.Text = product.LP_price.ToString();

            //Set the values of drop down list
            ddlImg.SelectedValue = product.LP_image;
            ddlTyp.SelectedValue = product.Type_ID.ToString();
        }
コード例 #2
0
        private void fPage()
        {
            //select laptop data
            if (!string.IsNullOrWhiteSpace(Request.QueryString["ID"]))
            {
                int        ID      = Convert.ToInt32(Request.QueryString["ID"]);
                LPModel    model   = new LPModel();
                tblProduct product = model.GetProduct(ID);

                //Fill page with data
                lblTitle.Text      = product.LP_name;
                lblDesc.Text       = product.LP_desc;
                lblPrice.Text      = "Price per Item: $ " + product.LP_price;
                imgLaptop.ImageUrl = "~/Images/" + product.LP_image;
                lblProNo.Text      = product.ID.ToString();

                //Fill quantity with numbers 1-20
                int[] amount = Enumerable.Range(1, 20).ToArray();
                ddlQuantity.DataSource           = amount;
                ddlQuantity.AppendDataBoundItems = true;
                ddlQuantity.DataBind();
            }
        }