public void rptPages_ItemCommand(object source, RepeaterCommandEventArgs e) { PageNumber = Convert.ToInt32(e.CommandArgument) - 1; int nResult = int.Parse(ddlSoKetQua.SelectedItem.Value); LoadData(nResult, MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, true)); }
protected void ddlSoKetQua_SelectedIndexChanged(object sender, EventArgs e) { PageNumber = 0; int nResult = int.Parse(ddlSoKetQua.SelectedItem.Value); Session["nResult"] = nResult; yourvar = Session["q"].ToString(); nResultVar = nResult; if (!hpAName.Enabled) { LoadData(nResult, MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, true)); } else if (!hpDName.Enabled) { LoadData(nResult, MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, false)); } else if (!hpAPrice.Enabled) { LoadData(nResult, MonAnDAO.LayDanhSachSapTheoGia(maDanhMucMonAn, true)); } else if (!hpDPrice.Enabled) { LoadData(nResult, MonAnDAO.LayDanhSachSapTheoGia(maDanhMucMonAn, false)); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string req = string.Empty; if (Request.QueryString["s"] != null) { req = Request.QueryString["s"].ToString(); } if (req == "aname") { LoadData(int.Parse(Session["nResult"].ToString()), MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, true)); hpAName.Enabled = false; hpAName.ControlStyle.Font.Bold = true; hpAName.ForeColor = Color.Black; hpDName.Enabled = true; hpAPrice.Enabled = true; hpDPrice.Enabled = true; } else if (req == "dname") { LoadData(int.Parse(Session["nResult"].ToString()), MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, false)); hpAName.Enabled = true; hpDName.Enabled = false; hpDName.ControlStyle.Font.Bold = true; hpDName.ForeColor = Color.Black; hpAPrice.Enabled = true; hpDPrice.Enabled = true; } else if (req == "aprice") { LoadData(int.Parse(Session["nResult"].ToString()), MonAnDAO.LayDanhSachSapTheoGia(maDanhMucMonAn, true)); hpAName.Enabled = true; hpDName.Enabled = true; hpAPrice.Enabled = false; hpAPrice.ControlStyle.Font.Bold = true; hpAPrice.ForeColor = Color.Black; hpDPrice.Enabled = true; } else if (req == "dprice") { LoadData(int.Parse(Session["nResult"].ToString()), MonAnDAO.LayDanhSachSapTheoGia(maDanhMucMonAn, false)); hpAName.Enabled = true; hpDName.Enabled = true; hpAPrice.Enabled = true; hpDPrice.Enabled = false; hpDPrice.ControlStyle.Font.Bold = true; hpDPrice.ForeColor = Color.Black; } else { LoadData(int.Parse(Session["nResult"].ToString()), MonAnDAO.LayDanhSachSapTheoTen(maDanhMucMonAn, true)); hpAName.Enabled = false; hpAName.ControlStyle.Font.Bold = true; hpAName.ForeColor = Color.Black; hpDName.Enabled = true; hpAPrice.Enabled = true; hpDPrice.Enabled = true; } ddlSoKetQua.SelectedValue = Session["nResult"].ToString(); bind(); TinhTongTien(); } }