// The id parameter should match the DataKeyNames value set on the control // or be decorated with a value provider attribute, e.g. [QueryString]int id public SAN_PHAM SanPhamDetail_GetItem([QueryString("MaSP")] int id) { sanPhamDAL sp = new sanPhamDAL(); var sp2 = sp.GetDVByMa(id); return(sp2); }
// The id parameter should match the DataKeyNames value set on the control // or be decorated with a value provider attribute, e.g. [QueryString]int id public SAN_PHAM SanPhamDetail_GetItem([QueryString("MaSP")] int id) { DB_SPAEntities context = new DB_SPAEntities(); sanPhamDAL sp = new sanPhamDAL(); var sp2 = sp.GetDVByMa(id); return(sp2); }
protected void Page_Load(object sender, EventArgs e) { if (Session["cart"] == null) { lb_notify.Text = "Giỏ Hàng Trống"; lb_notify.Visible = true; btn_datHang.Visible = false; } else { btn_datHang.Visible = true; double tong = 0; List <CartModel> list = (List <CartModel>)Session["cart"]; foreach (var i in list) { SAN_PHAM sp = sanPhamService.GetDVByMa(i.MA_SP); tong += sp.GIA.GetValueOrDefault() * i.SO_LUONG; } lb_tongtien.Visible = true; lb_tongtien.Text = tong.ToString(); lb_title.Visible = true; } }
protected void addDataIntoControl() { sanPhamDAL spDAL = new sanPhamDAL(); var idSP = Request.QueryString["MaSP"]; var sp = spDAL.GetDVByMa(Convert.ToInt32(idSP)); if (sp != null) { txt_tenSP.Text = sp.TEN_SP; txt_moTa.Text = sp.MO_TA; txt_anh.Text = sp.ANH; txt_gia.Text = sp.GIA.ToString(); } }
protected void addDataIntoControl() { try { sanPhamDAL spDAL = new sanPhamDAL(); var idSP = Request.QueryString["MaSP"]; var sp = spDAL.GetDVByMa(Convert.ToInt32(idSP)); if (sp != null) { txt_tenSP.Text = sp.TEN_SP; txt_moTa.Text = sp.MO_TA; txt_gia.Text = sp.GIA.ToString(); } } catch (Exception ex) { lb_messenger.Text = ex.ToString(); } ViewState["Edit_sp"] = true; }