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