Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GoodEatsFarmDataContext db = new GoodEatsFarmDataContext();
            Guid catID = new Guid("b6385b44-1b6d-41ab-81df-d265d363dea7");
            var  data  = db.uspProductsGetbyCat("e4db916e-5427-42d0-8a94-6ced86bedabe").ToArray();
            int  rows  = data.Length;

            for (int i = 0; i < rows; i++)
            {
                Image picture = new Image();
                picture.ID = "picture" + i;
                //picture.Width = 306;
                //picture.Height = 204;
                picture.Attributes.Add("class", "productImage");
                TableRow  row     = new TableRow();
                TableCell cellOne = new TableCell();
                TableCell cellTwo = new TableCell();

                string prodID        = data[i].ProductID.ToString();
                string prodName      = data[i].Name;
                string prodPriceInfo = data[i].PriceInfo;
                string prodDesc      = data[i].Description;
                picture.ImageUrl = data[i].ImagePath;

                cellOne.Controls.Add(picture);
                cellTwo.Text            = "<p class=\"content-words\"><b>" + prodName + "</b><br />" + prodPriceInfo + "<br />" + prodDesc + "</p>";
                cellTwo.HorizontalAlign = HorizontalAlign.Left;
                //cellOne.Width = 320;

                row.Cells.Add(cellOne);
                row.Cells.Add(cellTwo);
                Table1.Rows.Add(row);
            }
        }
 protected void chkbxCategory2_SelectedIndexChanged(object sender, EventArgs e)
 {
     prodViewCat = chkbxCategory2.SelectedValue;
     if (prodViewCat != "" && prodViewCat != "none")
     {
         GoodEatsFarmDataContext db = new GoodEatsFarmDataContext();
         var prodData = db.uspProductsGetbyCat(prodViewCat);
         gvProducts.DataSource = prodData;
         gvProducts.DataBind();
     }
 }
 protected void ddlCategory2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlCategory2.SelectedValue != "67a6ec19-a89b-43c9-8b69-a6711673c77e")
     {
         chkbxCategory2.Visible = false;
         prodViewCat            = ddlCategory2.SelectedValue;
     }
     else
     {
         chkbxCategory2.Visible = true;
     }
     if (prodViewCat != "" && prodViewCat != "none")
     {
         GoodEatsFarmDataContext db = new GoodEatsFarmDataContext();
         var prodData = db.uspProductsGetbyCat(prodViewCat);
         gvProducts.DataSource = prodData;
         gvProducts.DataBind();
     }
 }