protected void Next_OnClick(object sender, EventArgs e) { int currentPage = int.Parse(Session["CurrentPage"].ToString()); var hotels = _discountRepository.GetAll().OrderBy(x => x.Status).Skip(currentPage * Constant.ItemPerPage).Take(Constant.ItemPerPage).ToList(); if (hotels.Any()) { Session["CurrentPage"] = currentPage + 1; RptDiscountListings.DataSource = hotels; RptDiscountListings.DataBind(); } }
protected void Page_Init(object sender, EventArgs e) { Session["Active"] = "DiscountsPage"; if (!IsPostBack) { Session["CurrentPage"] = 1; RptDiscountListings.DataSource = _discountRepository.GetAll().OrderBy(x => x.Status).Take(Constant.ItemPerPage); RptDiscountListings.DataBind(); } }