Beispiel #1
0
        //On load
        //Get all the products details from db
        //Display them via databinding
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Models.Product p = new Models.Product();

                int productID = Convert.ToInt32(Request.Params["productID"]);
                p = BusinessLogic.GetProduct(productID);

                DataTable dt = new DataTable();
                DataRow   dr = null;
                dt.Columns.Add("ProductName", typeof(String));
                dt.Columns.Add("ProductImage", typeof(String));
                dt.Columns.Add("ProductID", typeof(String));
                dt.Columns.Add("ProductPrice", typeof(decimal));
                dt.Columns.Add("ProductManufacturer", typeof(String));
                dt.Columns.Add("ProductDescription", typeof(String));
                dt.Columns.Add("ProductMaterial", typeof(String));

                dr = dt.NewRow();
                dr["ProductName"]         = p.productName;
                dr["ProductImage"]        = p.productImage;
                dr["ProductID"]           = p.productID;
                dr["ProductPrice"]        = p.productPrice;
                dr["ProductManufacturer"] = p.productManufacturer;
                dr["ProductDescription"]  = p.productDescription;
                dr["ProductMaterial"]     = p.productMaterial;
                dt.Rows.Add(dr);

                dt.AcceptChanges();
                ProductListing.DataSource = dt;
                ProductListing.DataBind();
            }
        }