Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     db       = new DBConnect();
     basketDB = new BasketDatabase();
     task();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            db       = new DBConnect();
            basketDB = new BasketDatabase();



            product = db.bringAllProducts();
            //productList = db.bringAllProductsAsList();
            for (int i = 0; i < product.Count; i = i + 6)
            {
                HtmlTableCell cell1 = new HtmlTableCell();
                HtmlTableCell cell2 = new HtmlTableCell();
                HtmlTableCell cell3 = new HtmlTableCell();
                HtmlTableCell cell4 = new HtmlTableCell();


                cell1.InnerText = product[i];
                cell2.InnerText = product[i + 3];
                cell3.InnerText = "1";
                cell4.InnerText = "1";


                HtmlTableRow row = new HtmlTableRow();
                row.Controls.Add(cell1);
                row.Controls.Add(cell2);
                row.Controls.Add(cell3);
                row.Controls.Add(cell4);
                row.Attributes.Add("class", "product");
                ProductInnerTable.Rows.Add(row);
            }
            ////////for (int i=0; i<product.Count; i = i + 6)
            ////////{
            ////////    Button btn = new Button();
            ////////    btn.ID = product[i];
            ////////    btn.BackColor = System.Drawing.Color.Green;
            ////////    btn.ForeColor = System.Drawing.Color.Yellow;
            ////////    btn.Click += new EventHandler(sub_click);
            ////////    TableCell cell1 = new TableCell();
            ////////    TableCell cell2 = new TableCell();
            ////////    TableCell cell3 = new TableCell();
            ////////    TableCell cell4 = new TableCell();
            ////////    //cell.Text = product.ElementAt(i);
            ////////    btn.Text = "Detaylar";


            ////////    //btn.Style["background-color"] = "Red";
            ////////    //btn.CssClass = "ProductTable";
            ////////    //btn.Style.Add("ProductTable", "Red");
            ////////    cell1.Text = product[i];
            ////////    //cell1.Controls.Add(btn);
            ////////    cell2.Text = product[i+1];
            ////////    cell3.Text = product[i+2];
            ////////    cell4.Controls.Add(btn);
            ////////    TableRow row2 = new TableRow();
            ////////    //row2.Controls.Add(btn);

            ////////    row2.Controls.Add(cell1);

            ////////    row2.Controls.Add(cell2);
            ////////    row2.Controls.Add(cell3);
            ////////    row2.Controls.Add(cell4);
            ////////    ProductTable.Controls.Add(row2);
            ////////}

            //foreach(var data in product)
            //{
            //    product.
            //    TableCell cell = new TableCell();
            //    cell.Text = data;
            //    TableRow row2 = new TableRow();
            //    row2.Controls.Add(cell);
            //    ProductTable.Controls.Add(row2);
            //}
            ////task();
        }