protected void Page_Load(object sender, EventArgs e) { XulyLayThongTinSanPhamByID sanphamID = new XulyLayThongTinSanPhamByID(); sanphamID.thongtinsanpham.MaSanPham = this.MaSP; sanphamID.Thucthi(); datalist1.DataSource = sanphamID.Dttable; datalist1.DataBind(); }
public void HienthiSPTheoMa() { ThongTinSanPham sp = new ThongTinSanPham(); sp.MaSanPham = int.Parse(Request.QueryString.Get("MaSanPham")); XulyLayThongTinSanPhamByID SanphamID = new XulyLayThongTinSanPhamByID(); SanphamID.thongtinsanpham.MaSanPham = sp.MaSanPham; try { SanphamID.Thucthi(); DropdownMaNSX.SelectedIndex = DropdownMaNSX.Items.IndexOf(DropdownMaNSX.Items.FindByText(SanphamID.thongtinsanpham.Nhasx.TenNSX)); DropdownPhongCach.SelectedIndex = DropdownPhongCach.Items.IndexOf(DropdownPhongCach.Items.FindByText(SanphamID.thongtinsanpham.Phongcach.TenPhongCach)); DropdownMaKieuDang.SelectedIndex = DropdownMaKieuDang.Items.IndexOf(DropdownMaKieuDang.Items.FindByText(SanphamID.thongtinsanpham.Kieudang.TenKieuDang)); txtTenSanPham.Text = SanphamID.thongtinsanpham.TenSanPham; txtMoTaSanPham.Text = SanphamID.thongtinsanpham.MoTa; txtGiaSanPham.Text = SanphamID.thongtinsanpham.GiaSanPham.ToString(); txtSoLuong.Text = SanphamID.thongtinsanpham.SoLuong.ToString(); txtHDH.Text = SanphamID.thongtinsanpham.TenHDH; txtRAM.Text = SanphamID.thongtinsanpham.RAM; txtCamera.Text = SanphamID.thongtinsanpham.Camera; txtPin.Text = SanphamID.thongtinsanpham.Pin.ToString(); Label1.Text = SanphamID.thongtinsanpham.ImageSP; image1.ImageUrl = SanphamID.thongtinsanpham.ImageSP; } catch { lbThongbao.Text = "Lỗi! không lấy được DL"; } }