private void FillPage(int id) { Models.ProductModel productmodel = new Models.ProductModel(); Product product = productmodel.GetProduct(id); txtDescription.Text = product.Description; txtName.Text = product.Name; txtPrice.Text = product.Price.ToString(); ddlImage.SelectedValue = product.Image; ddlType.SelectedValue = product.TypeID.ToString(); }
private void FillPage() { if (!String.IsNullOrWhiteSpace(Request.QueryString["id"])) { int id = Convert.ToInt32(Request.QueryString["id"]); Models.ProductModel productModel = new Models.ProductModel(); WebApplication1.Product product = productModel.GetProduct(id); lblPrice.Text = "Price per unit: <br/>$ " + product.Price; lblTitle.Text = product.Name; lblDescription.Text = product.Description; lblItemNr.Text = id.ToString(); imgProduct.ImageUrl = "~/Images/Products/" + product.Image; int[] amount = Enumerable.Range(1, 20).ToArray(); ddlAmount.DataSource = amount; ddlAmount.AppendDataBoundItems = true; ddlAmount.DataBind(); } }