コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Table                      dt = new Table();
            RepositoryFile             rf = new RepositoryFile();
            List <ProductsInformation> li = new List <ProductsInformation>();

            li = rf.GetDetails();
            foreach (ProductsInformation pi in li)
            {
                TableRow tr = new TableRow();


                TableCell tc = new TableCell();

                Image img = new Image();
                img.ImageUrl = "~//" + pi.ImageUrl.ToString();
                img.Height   = 100;
                img.Width    = 100;

                HyperLink hl = new HyperLink();
                hl.NavigateUrl = "ProductsDescription.aspx?id=" + pi.Id;
                hl.Text        = pi.Name.ToString();

                tc.Controls.Add(img);
                tc.Controls.Add(hl);
                tr.Cells.Add(tc);

                dt.Rows.Add(tr);
                PlaceHolder1.Controls.Add(dt);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RepositoryFile             rf = new RepositoryFile();
            List <ProductsInformation> li = new List <ProductsInformation>();

            li = rf.GetDetails();
            int pid = Convert.ToInt32(Request.QueryString["id"]);

            foreach (ProductsInformation obj in li)
            {
                if (pid == obj.Id)
                {
                    ProductName.Text         = obj.Name.ToString();
                    ProductPrice.Text        = obj.Price.ToString();
                    ProductImage.ImageUrl    = obj.ImageUrl.ToString();
                    ProductsDescription.Text = obj.Description.ToString();
                }
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Table                      dt = new Table();
            RepositoryFile             rf = new RepositoryFile();
            List <ProductsInformation> li = new List <ProductsInformation>();

            li = rf.GetDetails();
            foreach (ProductsInformation pi in li)
            {
                TableRow tr = new TableRow();
                dt.Rows.Add(tr);

                TableCell tc = new TableCell();
                tr.Cells.Add(tc);
                Image img = new Image();
                PlaceHolder1.Controls.Add(img);
                img.ImageUrl = "~//" + pi.ImageUrl.ToString();
                img.Height   = 100;
                img.Width    = 100;

                HyperLink HlPreview = new HyperLink();
                PlaceHolder1.Controls.Add(HlPreview);
                HlPreview.NavigateUrl = "ProductsDescription?id=" + pi.Id;
                HlPreview.Text        = "Preview";

                HyperLink HlUpdate = new HyperLink();
                PlaceHolder1.Controls.Add(HlUpdate);
                HlUpdate.NavigateUrl = "ProductUpdate?id=" + pi.Id;
                HlUpdate.Text        = "Update";

                HyperLink HlDelete = new HyperLink();
                PlaceHolder1.Controls.Add(HlDelete);
                HlDelete.NavigateUrl = "ProductDelete?id=" + pi.Id;
                HlDelete.Text        = "Delete";
            }
        }