protected void Page_Load(object sender, EventArgs e) { Table T = new Table(); ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); foreach (Product p in L) { TableRow TR = new TableRow(); T.Rows.Add(TR); TableCell TC = new TableCell(); Image im = new Image(); im.ImageUrl = "~//" + p.PURL.ToString(); im.Width = 161; im.Height = 217; HyperLink HL = new HyperLink(); HL.Text = p.PName.ToString(); HL.ID = "Hyperlink_file"; HL.NavigateUrl = "ProductDescrptionPage.aspx?id=" + p.PId; PlaceHolder1.Controls.Add(im); PlaceHolder1.Controls.Add(HL); TR.Cells.Add(TC); } }
protected void Page_Load(object sender, EventArgs e) { ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); int id = Convert.ToInt32(Request.QueryString["id"]); foreach (Product p in L) { if (id == p.PId) { Productid.Text = p.PId.ToString(); images.ImageUrl = p.PURL.ToString(); Name.Text = p.PName.ToString(); Price.Text = p.PPrice.ToString(); Description.Text = p.PDescription.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Context.User.IsInRole("Product")) { Response.Redirect("NotAuthorized.aspx"); } Table T = new Table(); ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); foreach (Product p in L) { TableRow TR = new TableRow(); T.Rows.Add(TR); TableCell TC = new TableCell(); Image im = new Image(); im.ImageUrl = "~/" + p.PURL.ToString(); im.Width = 161; im.Height = 217; HyperLink HLPreview = new HyperLink(); HLPreview.Text = "Pre-View"; HLPreview.ID = "Hyperlink_file"; HLPreview.NavigateUrl = "ProductPreview.aspx?id=" + p.PId; HyperLink HLUpdate = new HyperLink(); HLUpdate.Text = "Update"; HLUpdate.ID = "Hyperlink_file"; HLUpdate.NavigateUrl = "ProductUpdate.aspx?id=" + p.PId; HyperLink HLDelete = new HyperLink(); HLDelete.Text = "Delete"; HLDelete.ID = "Hyperlink_file"; HLDelete.NavigateUrl = "ProductDelete.aspx?id=" + p.PId; PlaceHolder1.Controls.Add(im); PlaceHolder1.Controls.Add(HLPreview); PlaceHolder1.Controls.Add(HLUpdate); PlaceHolder1.Controls.Add(HLDelete); TR.Cells.Add(TC); } }
protected void Page_Load(object sender, EventArgs e) { //if (!Context.User.IsInRole("User")) //{ // Response.Redirect("NotAuthorized.aspx"); //} ProductRepositoy r = new ProductRepositoy(); List <Product> L = r.GetallProducts(); int id = Convert.ToInt32(Request.QueryString["id"]); foreach (Product p in L) { if (id == p.PId) { Image1.ImageUrl = p.PURL.ToString(); ProductName.Text = p.PName.ToString(); ProductPrice.Text = p.PPrice.ToString(); ProductDescrption.Text = p.PDescription.ToString(); } } }