protected void HotelGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { HotelGridView.PageIndex = e.NewPageIndex; if (Session["HOTELDS"] != null) { DataSet dsHotel = (DataSet)Session["HOTELDS"]; HotelGridView.DataSource = dsHotel; HotelGridView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { HotelManager hotelManager = new HotelManager(); DataSet hotelDS = hotelManager.GetAllHotels(); if (Session["HOTELDS"] == null) { Session["HOTELDS"] = hotelDS; } HotelGridView.AutoGenerateColumns = true; HotelGridView.DataSource = hotelDS; HotelGridView.DataBind(); } }