Beispiel #1
0
 public void LoadAnhPhu()
 {
     try
     {
         // Load Anh Phu
         Anh anhphu = new Anh();
         DataSet dsAnh = anhphu.SelectBySanPhamID(int.Parse(ViewState["ID"].ToString()));
         if (dsAnh.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow drAnh in dsAnh.Tables[0].Rows)
             {
                 HtmlImage img = new HtmlImage();
                 img.Src = "." + drAnh["DuongDan"];
                 img.Height = 50;
                 img.Width = 50;
                 img.ID = "img" + drAnh["AnhID"];
                 img.Attributes.Add("onclick",
                                    "return XoaAnhPhu('" + drAnh["AnhID"] + "', '" + img.Src + "', this.ID, this);");
                 pnlAnhPhu.Controls.Add(img);
             }
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.ToString());
     }
 }
Beispiel #2
0
    private void ShowAnhSanPham()
    {
        try
        {
            Anh anh = new Anh();
            DataSet ds = anh.SelectBySanPhamID(int.Parse(ViewState["SanPhamID"].ToString()));

            pnlAnhSanPham.Controls.Clear();
            HtmlImage img = new HtmlImage();
            img.Height = 40;
            img.Width = 40;
            img.Src = imgSanPham.Src;
            img.Style.Add("cursor", "hand");
            img.Attributes.Add("onclick", "Enlarge(this.src);");

            pnlAnhSanPham.Controls.Add(img);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                img = new HtmlImage();
                img.Src = dr["DuongDan"].ToString();
                img.Height = 40;
                img.Width = 40;
                img.Style.Add("cursor", "hand");
                img.Attributes.Add("onclick", "Enlarge(this.src);");
                pnlAnhSanPham.Controls.Add(img);
            }
        }
        catch (Exception ex)
        {
            //Response.Redirect("Message.aspx?msg=" + ex.Message.Replace("\r\n", " "), false);
            Response.Write(ex.ToString());
        }
    }