//----------Hiện sản phẩm theo id sản phẩm-------------- private void HienSanPham() { MOONLY.Common.SanPham Spham = new MOONLY.Common.SanPham(); Spham.Idsanpham = int.Parse(Request.QueryString["Idsanpham"]); XuLyLaySanPhamByID laySanPhamByID = new XuLyLaySanPhamByID(); laySanPhamByID.Sanpham = Spham; try { laySanPhamByID.Thucthi(); txtTenSanPham.Text = laySanPhamByID.Sanpham.Ten; CKEditorControlMoTa.Text = laySanPhamByID.Sanpham.Mota; textGia.Text = laySanPhamByID.Sanpham.Giasanpham.ToString(); imgHinhSanPham.ImageUrl = "../HienThiHinhSanPham.ashx?Idhinhsanpham=" + laySanPhamByID.Sanpham.Idhinhsanpham.ToString(); dropDanhMucSanPham.SelectedIndex = dropDanhMucSanPham.Items.IndexOf(dropDanhMucSanPham.Items.FindByText( laySanPhamByID.Sanpham.Danhmucsanpham.Tendanhmucsanpham)); LuuTamIdHinhSanPham = laySanPhamByID.Sanpham.Idhinhsanpham; } catch { Response.Redirect("../Trangloi.aspx"); } }
private void Hienchitietsanpham() { SanPham Spham = new SanPham(); Spham.Idsanpham = int.Parse(Request.QueryString["IdSanPham"]); XuLyLaySanPhamByID laySanPham = new XuLyLaySanPhamByID(); laySanPham.Sanpham = Spham; try { laySanPham.Thucthi(); } catch { Response.Redirect("Trangloi.aspx"); } dtlChiTietSanPham.DataSource = laySanPham.Ketqua; // dtlChiTietSanPham là ID của DataList dtlChiTietSanPham.DataBind(); }